Mariana Tek uses OAuth 2.0 in order to authenticate users. The flow that should be used is determined by the type of your application. For traditional web apps like this demo, the Authorization Code Flow should be used.
A user will authenticate with this flow as follows:
redirect_url
your application provided
as part of Step 1, with the authorization code returned as a query parameter.
access_token
by making a request to
the token endpoint.
Once these steps are complete, the access token may be stored and used to authenticate subsequent API requests.
Before you get started, you’ll need a valid client_id
and client_secret
for your application,
as well as the base url for the brand you wish to connect to within the Mariana Tek platform. If
you don’t have these values yet, contact your account manager to register your application. When
your application is registered, make sure to provide your redirect_uri
so that this OAuth flow
can be completed successfully.
Once you have these pieces of information, your authorization redirect should look like this:
https://{BRAND}.marianatek.com/o/authorize?response_type=code&client_id={CLIENT_ID} &redirect_uri={REDIRECT_URI}&scope=read:account&state={STATE}
The value of state will be returned along with the authorization code.
If you would like to require users to log in each time they are authorized, even if they have an active
session, you may set the optional query parameter prompt=true
.
Here is an example of how this can be done:
Click here to log in
After successful authorization, the user will be sent to the redirect_uri
that was specified.
The authorization code will be returned as a query parameter.
This redirect will look like this:
https://example.marianatek.com/callback?code={AUTHORIZATION_CODE}&state={STATE}
Using the authorization code that should have been retrieved in the previous step, your application should now make a request to the token endpoint:
POST https://{BRAND}.marianatek.com/o/token?client_id={CLIENT_ID}&code={AUTHORIZATION_CODE} &grant_type=authorization_code
The response will look like this:
{ "access_token": {ACCESS_TOKEN}, "expires_in": 604800, "token_type": "Bearer", "scope": "read:account", "refresh_token": {REFRESH_TOKEN}, }