Spotnana authentication flows - Overview
TABLE OF CONTENTS
Spotnana offers various authentication methods that allow partners to support secure integration with our platform. This documentation provides an overview of the different authentication methods currently supported by Spotnana, along with detailed explanations of their process flow. The different authentication flows mentioned here demonstrate how Spotnana authenticates and authorizes users to access protected organization-level resources (i.e., the resources owned by the user’s company on the Spotnana platform).
Key components
Before you get started, review this list for definitions of the essential system components referred to in this documentation.
- Spotnana UI(Spotnana User Interface) Refers to the Spotnana frontend web application (i.e., the Online Booking Tool) or the Spotnana mobile application. More specifically, it refers to the login page, which triggers the frontend authentication flow when the user logs in or creates a new login.
- Spotnana server Refers to the Spotnana backend server used for authentication purposes (e.g., authorizing a user to access a resource and to store and process user information safely).
- Partner UI (Partner's User Interface) The user interface (i.e., the frontend application) used by the partners to access the Spotnana platform. For example, in the iFrame-based authentication, the Spotnana platform is embedded into the partner’s User Interface (UI) and their users will access Spotnana via the partner UI.
- Partner server Refers to one or more backend servers used by our partners to integrate with Spotnana.
- Spotnana IdP (Spotnana Identity Provider) Refers to Spotnana’s internal service used for user identity management and authorization.
- Partner IdP Third-party Identity Providers (IdP) used by the partners. Some common IdPs are Google and Azure.
- OBT Spotnana’s Online Booking Tool (OBT), which can be accessed at https://app.spotnana.com/
- Subject token In iFrame-based (or token exchange) authentication, a subject token represents the user's identity. This token will be used to look up their information and authorize them to access the Spotnana platform.
- Access token A credential (OAuth) used by a partner application to access protected resources on behalf of a user. It is a temporary authorization key, allowing applications to make API requests without exposing the user's credentials.
- Refresh token A long-lived credential used to obtain new access tokens without requiring the user to re-authenticate. This is usually issued along with the access token when it’s created during the first login session.
- Client credentials The information provided to the users who are directly connecting to Spotnana APIs (i.e., a unique
clientId
andclientSecret
). - PID (Personal identifier) A personal identifier created for the user. The PID retrieves the user information from the Spotnana server.
orgId
A unique identifier assigned by Spotnana for the user’s organization.tmcId
A unique identifier assigned by Spotnana for a TMC (Travel Management Company).
Supported authentication methods
The following are the various authentication methods supported by Spotnana:
- Password-based authentication
- IDP-based authentication
- API-based authentication
- iFrame-based authentication
- Auth code-based authentication
- Machine-to-machine (M2M) authentication
Password-based authentication
When using password-based authentication, the Spotnana UI (i.e., the login or signup page in the OBT) initiates and manages the authentication process with the Spotnana backend servers. This approach can have two different flows depending on whether the user logs in with an existing profile or signs up to create a new profile. Each of these two authentication flows are explained in the sections below using sequence diagrams.
Existing user
The sequence diagram and the steps below explain how the Spotnana UI interacts with the backend services to authenticate an existing user.
Fig: A sequence diagram explaining the password-based authentication for existing users.
Step | Flow |
---|---|
An existing user logs in via the OBT or the Spotnana mobile application using their email. | |
1 |
|
2 |
|
3 |
|
New user
The sequence diagram and the steps below explain how the Spotnana UI interacts with the backend services to authenticate a new user (or an existing user who’s trying to reset their password).
Fig: A sequence diagram explaining the password-based authentication for new users.
Step | Flow |
---|---|
A new or an existing user enters their email on the Spotnana OBT login page and clicks Next. | |
1 |
|
1 a |
|
2 |
|
3 |
|
4 |
|
IDP-based authentication
Spotnana supports authentication via IDPs such as Google, Azure, and custom IDPs using OpenID connect, as well as SAML protocols. The sequence diagram and the steps below explain the IDP-based authentication flow.
Fig: A sequence diagram explaining the IDP-based authentication flow.
Step | Flow |
---|---|
A user logs in via the OBT or the Spotnana mobile application using their email. | |
1 |
|
2 |
|
3 |
Note: For every redirect, a 302 status code is returned to indicate that the request has been redirected to a different URL. |
4 |
Note: During this connection, Spotnana IdP sends the |
5 |
Note: After this step, the user profile must still go through the bearer token verification. |
5 a |
|
5 b |
|
6 |
Note: A successful creation of bearer token indicates that the user has been authenticated and is allowed to access Spotnana. |
7 |
|
API-based authentication
Partners who use Spotnana’s APIs to connect to the Spotnana platform can use our authentication endpoint to generate a bearer token for their users. The following sequence diagram illustrates the authentication flow for any partner using API-based authentication.
Fig: A sequence diagram explaining the API-based authentication.
Step | Flow |
---|---|
1 |
Heres a sample cUrl request to use when calling the curl -i -X POST \ https://api.spotnana.com/get-auth-token \ -H 'Content-Type: application/json' \ -d '{ "clientId": "sample-apiuser@tmcorg.com", "clientSecret": "<password>" }' Note: Replace the |
2 |
|
Once the API user has received the bearer token, all the subsequent requests made to Spotnana APIs (e.g., Trip APIs) must include the bearer token in the header for authorization.
Note: The get-auth-token(clientId, clientSecret)
endpoint has a rate limit of 100 API calls per 5 minutes.
iFrame-based authentication
An iFrame or an embedded solution is when partners embed the Spotnana UI into the partner UI, which means users access Spotnana via the partner UI. In this scenario, the user authentication is handled based on token exchange between the partner and Spotnana systems.
Note: For iFrame-based authentication, the user logging in will be referred to as a caller. This is to allow for specific scenarios where an API/Machine user logs in and requests an access token for another user. This API/Machine user could use TMC (Travel Management Company) admin credentials to connect directly with the Spotnana server. Hence, we’ll be using caller as a generalized term, which can refer to a user logging into their own profile or an API/Machine user requesting an access token for another user.
The following sequence diagram illustrates how the authentication flow is handled using a token exchange between Spotnana and the partner servers.
Fig: A sequence diagram explaining the iFrame-based authentication using token exchange.
Step | Flow |
---|---|
A caller logs in using the Partner UI. | |
1 |
|
1 a |
|
1 b |
|
1 c |
|
2 |
|
3 |
Note: A successful creation of bearer token indicates that the user has been authenticated and is allowed to access Spotnana. |
4 |
|
Auth code-based authentication
The following sequence diagram illustrates how the authentication flow is handled using an authorization code.
Fig: A sequence diagram explaining the auth code-based authentication using auth code.
Step | Flow |
---|---|
1 |
|
2 |
|
3 |
|
3 a |
|
3 b |
|
4 |
Note: A successful creation of bearer token indicates that the user has been authenticated and is allowed to access Spotnana. |
5 |
|
Note: This authentication flow cannot be used in scenarios where a TMC admin allows more than one user to use the same email when logging in.
Machine-to-machine (M2M) authentication
The M2M authentication method is suitable when the authentication flow involves the client application accessing a third-party callback URL to generate the accessToken
for the user. The following sequence diagram illustrates the M2M authentication flow.
Fig: A sequence diagram explaining the M2M authentication flow.
Step | Flow |
---|---|
The public keys for all the applications used in the authentication are synced between Spotnana server and Spotnana IdP. This will later be used to verify the access token in the authentication flow. | |
1 |
|
2 |
|
3 |
|
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article