Skip to main content

Custom Sign-In (SSO)

All Cloudike branded apps, mobile and web, can use a custom web sign-in form through the SSO service.
This is useful when you:

  • Already have your own authorization flow and don't want to give Cloudike access to user credentials
  • Often change the sign-in flow (for example, for A/B tests) and don't want to update the mobile apps every time
  • Need to show different sign-in flows to different groups of users

See the Cloudike SSO API reference.

How it works​

To authorize a user in the Cloudike backend, the app needs a Mountbit-Auth token, which it gets from the SSO service.

  1. The app creates an SSO ticket and gets the web page URL in the response from the Cloudike backend.
  2. The app opens the web page in a WebView.
  3. The web page asks for the user's credentials.
  4. The web page gets the Mountbit-Auth token and confirms the SSO ticket.
  5. The web page redirects to callback_url.
  6. The app gets the Mountbit-Auth token from callback_url and closes the WebView.

How to prepare your own auth form​

Step 1. Get the SSO ticket​

Your web page will get ticket_id as a GET parameter. For example:

https://<YOUR_PAGE>?ticket_id=<TICKET_ID>

Save TICKET_ID for next steps.

Step 2. Authorize user​

The web page authorizes the user and gets the Mountbit-Auth token.

Step 3. Confirm the SSO ticket​

Use the SSO ticket confirm API

You need to send TICKET_ID and MOUNTBIT_AUTH_TOKEN from the previous steps:

curl -X POST -H "Content-Type: application/json" \
-d '{"token": "<MOUNTBIT_AUTH_TOKEN>"}' \
https://<CLOUDIKE_BACKEND_HOST>/api/2/sso/tickets/<TICKET_ID>/confirm

The response will contain callback_url.

{
"callback_url": "<YOUR_PAGE>/callback/?token=<MOUNTBIT_AUTH_TOKEN>"
}

Step 4. Redirect to the callback page​

Change location to callback_url from the previous step. For example:

window.location.replace("<CALLBACK_URL>");

The app now has the Mountbit-Auth token and closes the WebView.