Which page applies to my app? This page only covers embedded login on constrained devices that can't easily open a browser (e.g. self-service kiosks, point-of-sale terminals or smart TVs): your app shows its own login screens, calls the Authentication API directly and exchanges the consent token for tokens with the JWT Bearer grant. Web, mobile and desktop apps should use the standard flow on the Browser page.
In this setup you connect your app to Quasr using the Authentication API and embed the login in your app. You call the Authentication API provided by Quasr directly from your application.
The flow is straightforward:
You sign up or login using the authentication factors and obtain a session token.
Once you reach the required score you can get a consent token with your session.
You exchange the consent token for identity and access tokens at the token endpoint.
This setup is not recommended and should only be used in exceptional circumstances. It's suitable for:
constrained devices that can't easily open a browser, such as self-service kiosks, point-of-sale terminals, smart TVs and other embedded devices
Web, mobile and desktop apps should use the browser flow - also when they have a back-end (BFF).
If you choose the embedded setup your users won't experience Single Sign-On (SSO), meaning that if a user wants to log into another application on the same device they'll have to log in again. Hence we advise you only choose this approach if you operate on constrained devices that only run a single app. If your device can open a browser it can still be beneficial not to go the embedded route if you want to improve user experience across different channels.
Detailed Flow
The sequence diagram below details the entire flow.
The token request above exchanges the consent token for identity and/or access tokens (this in contrast with the OIDC flows where an authorization code is used). This flow uses the OAuth 2.0 JWT grant type (urn:ietf:params:oauth:grant-type:jwt-bearer) and currently only accepts consent tokens.
Due to the embedded nature of this setup your app can contain up to four tokens:
session token (used for signup, login and consent = 2) - only used against Quasr, short/long-lived and multiple use
consent token (used to exchange for other tokens = 3/4) - only used against Quasr, short-lived and single use
identity token (to be used by your app for user info) - only used by your app, short-lived and single use
access token (to be used against your API backend) - only used against Quasr and/or your API; short/long-lived and multiple use
All play a distinct separate role and should be kept secure. The JWT Bearer grant doesn't issue refresh tokens.
Setup
The embedded approach is very similar to the Custom Login UI approach in that you'll use the Authentication API exactly the same but not from a separate login UI but from your application directly using the OAuth 2.0 token endpoint and JWT bearer grant.
It differs in that it doesn't need the OAuth 2.0 authorization call to kick off the flow and that the consent token at the end also does not need to be passed back to the OAuth 2.0 authorize API, but that it can be used directly to obtain tokens. High-level the process is as follows:
Embed your own login UI using the Quasr Authentication API.
Exchange the consent token directly for identity/access token.
Instead of step 8 make a POST request to https://{tenant_id}.api.quasr.io/oauth2/token with following body:
Make sure that the JWT bearer grant (urn:ietf:params:oauth:grant-type:jwt-bearer) is enabled for the client. This grant type requires client authentication (e.g. a client secret or private key), which an app can't keep secret. Hence the token request must be made by your back-end (BFF): your app passes the consent token to your back-end, which exchanges it for tokens.
1Lets your back-end exchange the consent token from the Authentication API for tokens
2Your back-end authenticates the token request - a device can't keep a secret
3The enrollment your back-end authenticates with, e.g. a signing key - rotate it by switching to a new one