Delegated AuthToken
Sometimes, for a third-party app or native mobile app integrations you may require to be able to create a secure login token and be able to log a user into your Magentrix Portal. Using the below end-point, you can obtain a one-time use Authentication Token and use this token to log a user in.
In order to obtain this token, first, you need to authenticate using administrator credentials.
Then, using the <sid> or session ID, you can call this endpoint to obtain the Authentication Token, see below:
POST https://<your-portal-domain>/rest/2.0/delegatedauthtoken?userId=<userId>
-H "Authorization: Bearer <sid>"
-H "Content-Type: application/json"
-H "Accept: application/json"
Optionally you can also pass a parameter to increase the timeout of the token, token by default lasts for 1 minute.
Parameter name: timeoutInMinutes
The response would something like this:
{
Token: "...."
}
Note: This method cannot be used to get tokens for other administrators for security reasons, just like the "login as" feature.
Once you have the Authentication Token, you can forward the user to the portal login address in the browser:
https://<your-portal-domain>/user/login?token=<Token>
Once the system logs the user in, they will be forwarded to their appropriate landing page based on their security role.
Note: In order to get better results, please make sure the users have already signed in for the first time into the portal and set their account up.