Authentication
Getting Started
The Turium Enigma OAuth2 framework is a very simple way to implement a Unified Token Authentication mechanism within your application. Here is a four step guide to helping you get up to speed and making calls to a Turium Enigma API.
Obtain Your Application clientID and clientSecret
Before you can obtain an accessToken
, you need to register an application with Turium Enigma You can do this by contacting your Account Manager. Once you have registered an application, you will receive a clientId
, clientSecret
and geolocation
. The clientId
is a unique UUID4 identifier for your application, and the clientSecret
is your application’s password. You will be using this credential to obtain tokens either for the application itself, or on behalf of a user. The geolocation
is your default base URI for initiating all new connections.
Obtaining an Access Token
In order for an application to call a Turium Enigma API, you need to obtain an accessToken
on behalf of either a User, Company or Application. There are multiple ways of obtaining an accessToken
through the various grants.
For simplicity, we will use the Password grant flow as an example. This is typically used for user-level Turium Enigma partner applications (i.e. where the user’s credentials will be captured and stored) but is used here for demonstration purposes. For company level authentication using the password grant, the username should equal the “Company UUID” and for the password, it will be the 24 hour temporary “request token”.
When making the call, you will use your app’s geolocation
as the base URI followed by the endpoint.
The first time you request for an accessToken
a refreshToken
is also returned. There are certain conditions where a refreshToken
is not returned. This is used to get a new accessToken
when one has expired. (see below for more info)
Calling an API with the Access Token
Once you have the accessToken
, you need to supply this in an Authorization header in the form of Authorization: Bearer <accessToken>
when making a HTTPS call. The accessToken
is a large string that looks something like this:
When you receive the accessToken
, store it with the token’s geolocation
. That geolocation
will be the base URI for all subsequent calls.
Armed with the accessToken
you can start making calls to a Turium Enigma API. Here’s an example to retrieve profile information for a User in the Production environment using cURL (utilize the appropriate base URI geolocation for the token) and the response will look like:
Access Token Expiry and Obtaining a Fresh One
Access Tokens have a default One hour lifetime. In order to obtain a fresh accessToken
you need to call the auth endpoint using the Refresh Grant. This will return a brand new accessToken
and a refreshToken
. Refresh Tokens have a default 6 month lifetime. Clients will typically store the refreshToken
together with the other user metadata like login information and unique identifiers.
Now that you’ve made your first call, read up more about the Turium Enigma APIs and how they can enhance your application or solve your business needs.
Last updated