Auth Flows
Cobalt’s auth flows provides a seamless environment for your users to grant authorization to their third party application data.
When creating application integrations, accessing customer’s data is a required step. Using Cobalt’s auth flows this process becomes both quick and heavily customizable.
Pre-requisites
Below are a few pre-requisites that you need to do before choosing an Auth Flow:
1. Create Linked Account
In order to enable your customer to connect to third party app, you first need to create a Linked account for them using a unique identifier.
Know more about Linked Accounts and how you can create one in the guide here.
We recommend you create a linked account at the same time as your customer signs up within your app.
2. Generate Session Token
Generate a Session Token for your Linked Account.
The session token gets expired in 24 hours. Please make sure you generate a new token in every new session or within 24 hours.
Auth flow integration options
Cobalt provides 3 different ways for Auth flow of integrations
Hosted flow
Redirects user to Cobalt Connect hosted on `https://connect.gocobalt.io`.
Hosted flow
Redirects user to Cobalt Connect hosted on `https://connect.gocobalt.io`.
Hosted flow is a no-code solution, so you don’t need to build your own UI to handle the integration authentication. It handles the following features:
- List all enabled applications
- Handle the Auth flow
- Manage integration configuration for your end user.
Dynamic field mapping feature is currently not supported in the Hosted auth flow.
To get started, follow the 2 steps:
Generate Hosted URL
To use Hosted flow, you will need to first get the hosted URL. This can be achieved by making a POST
request to the Create Hosted URL
API.
Check out the Cobalt’s API Reference for more details.
Redirect to Hosted portal
The generated URL can be then used to redirect the user to the Hosted UI, or can be embedded within your UI. Your user can select the application they want to connect and perform authentication.
You can modify the UI of Hosted Portal using the hosted_properties.
Property | Description |
---|---|
color | Modify the theme color of Cobalt connect |
name | Display name of your end customer |
bgColor | Background Colour of your end customer |
Embedded Flow
Utilize the React SDK and embed it seamlessly within your React application.
Embedded Flow
Utilize the React SDK and embed it seamlessly within your React application.
Cobalt Embedded flow is a frontend SDK that allows you to embed Cobalt auth flow into your React application.
It’s a simple process involving steps like Generate Session Token
> Install and Initialise Frontend SDK
and Render the Component
.
Learn more about Cobalt’s React SDK and how to initialize it here.
For example implementation, you can check out the App.js file in the example directory.
Seamless Flow
Utilize our REST APIs and NodeJs SDK methods to implement and customize the authentication experience.
Seamless Flow
Utilize our REST APIs and NodeJs SDK methods to implement and customize the authentication experience.
Cobalt provides APIs and SDK functions that allow your customers to connect your platform with the third party applications.
The general steps to build your own flow are:
Display a list of integrations for your users to select
Display a list of integrations for your users to select
Retrieve a list of all integrations available to connect using the List Applications API or .getApplications() method and display them in your UI.
With the above call you can get all the details related to an appliction for a user.
We recommend using the assets provided by Cobalt as they meet the requirements of the supported integrations. For example QuickBooks Online require the specific use of QuickBooks branded buttons, including specific hover states.
Install and Initialise SDK
Install and Initialise SDK
Install the Cobalt Frontend SDK for JavaScript that you want to use. You can install by either using npm package manager
or directly in browser by using the script
tag.
Initialize the javascript SDK using the Session token.
Learn more about Cobalt’s JS SDK and how to initialize it here.
Manage Connections
Manage Connections
Cobalt provides the flexibility for you to manage your customers’ application connections. The .connect()
method
lets your customers to connect to an application platform, authorizing you to access the platform APIs and data on their behalf.
The .disconnect()
method similarly, lets the user to disconnect from the application platform, revoking
the authorization and deleting any and all configurations of the Linked account saved for that particular application.
Allow users to configure the connection
Allow users to configure the connection
Once the user has successfully authenticated in their platform, he is redirected back to your app integration page. Use the .config()
method to find an
exisiting config or creating a new config for the linked account.
Save/Update the configuration
Save/Update the configuration
The .config()
method provides you with all the published workflows and settings input for the user. The user can now enable the workflows,
enter data for the settings and map fields. These updates to the config can be made using the .updateConfig()
method.
Authorization journey
Cobalt lets you take the authorization for customer’s data in 3 simple steps:
- Open the auth flow portal for the customer using any of the above mentioned integration options.
- Customer provides consent or API Credentials for the respective app.
- Customer configures the data required for the connection, such as selecting specific integration settings.