Only a super Admin user is allowed to proceed with this flow.Make sure to either:
- Send a valid
Authorization header with of type Bearer TOKEN_VALUE where TOKEN_VALUE is the token generated for the super admin.
- In case your app supports cookie, you can enable request cookies as our API Automatically sets a cookie named
session-token which is forwarded with each request to our api.
To generate an access token for a machine or service user, you will first need to obtain the machine user’s client ID and secret.
These credentials can be used to authenticate and gain access to the API programmatically.
Obtain Machine User Credentials
- First, create a machine user by making a POST request to the appropriate endpoint
(as described in this section).
- The response will include the machine user’s clientId and clientSecret.
Generate Access Token
- Use the clientId and clientSecret obtained from the machine user creation
API to generate an access token.
- The access token is required to authenticate subsequent API requests.
curl --request POST \
--url https://dev-iam.razi.ai/v1/authentication/machine-users/access-token \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--header 'Content-Type: application/json' \
--header 'X-App-Name: ' \
--data '{
"clientId": "example-client-id",
"clientSecret": "zNUTk6frtcdrpEbRiOYx3lGjZpou1oRGVxt40SUj2qkBzUVh8gybTmOObmFvDPKw"
}
Upon successful generation of the access token, you will receive a response similar to the below:{
"token": "<JWT TOKEN>",
"expiresInSeconds": 43199
}
This token can now be used to authenticate API requests on behalf of the machine user