Learn how to add API Authentication in UI Bakery
In case your API requires authentication with a certain set of headers or other query params, you can configure and add your HTTP API as a data source, so that you do not need to configure these parameters with every request. Also note that parameters configured in the datasource will be merged with the parameters configured in the specific request.
To configure the data source, navigate UI Bakery, select Data Sources - Connect - choose HTTP API.
You can add any standard type of authentication in UI Bakery:
- OAuth 2.0;
- Basic Auth;
- Custom header or query param.
OAuth 2.0 is a protocol that allows UI Bakery to access data sources hosted by other web apps on behalf of a user.
To set up OAuth 2.0 for datasource, choose the OAuth2 under Authentication Settings.
OAuth 2.0 settings
- UI Bakery redirect callback field is readonly, it should be set in API OAuth settings.
- Client ID and Client Secret should be filled with values provided by API.
- Authorization URL and Access Token URL should be filled with values provided by API.
- Scope is space-delimited list of permissions granted to data source.
When Require personal token is enabled, each user will be asked to authorise access to API. Each user will have their own token. Data sources with personal tokens can't be used in public apps by anonymous users or in automations. If personal token is off, then the token acquired during a data source creation will be used by all users.
Prompting user to give access for data source
In the data source configuration, you can use the
UI_BAKERY_OAUTH2_TOKENplaceholder, which will be replaced with the token value during the request. If ID token was requested you can use the
UI_BAKERY_OAUTH2_ID_TOKENplaceholder as well.
By default, the header
Authorization: Bearer UI_BAKERY_OAUTH2_TOKENwill be automatically added to each request to the data source with OAuth 2.0 enabled. You can override this behavior by adding your own Authorization header.
On enterprise plan you can use the
UI_BAKERY_SSO_TOKENplaceholder, it will be replaced with the token from Single Sign On authentication.
UI Bakery will try to automatically refresh token if refresh token is returned by API during authorization. If token refresh is not possible, the users will be asked to give access each time the token is expired.
To add Basic Authentication, choose the Basic Auth under Authentication Settings, specify your username and password.
Basic Authentication settings
Custom auth parameters
Once you have established the connection between UI Bakery and a required application via API, you can further access and manage the data.