Intent endpoint
To prevent exposing your access key, Authentication Cloud provides one-time tokens that are tied to a specific user and a specific intent. You can use this endpoint to request an intent token. When requesting an intent token, you need to specify the user for whom the token is issued and the purpose (intent) of the transaction that will be carried out. Use enroll
for registering new users, and approve
to sign a transaction for existing users.
HTTP request
POST https://{instance}.mauth.nevis.cloud/api/v1/intent
Parameters
Parameter | Type | Required/Optional | Description |
---|---|---|---|
username | string | required if userId is not provided | Represents the user that is the subject of the registration or approval operation. |
userId | UUID | required if username is not provided | Represents the user that is the subject of the registration or approval operation. |
operation | enum | required | Use enroll to register a new user, and approve for authenticating transactions such as a login or payment approval. |
channels | array | optional | Specify the list of channels to restrict the token to one or more specific intent. Channels can be app , push or sms . By default, it adds all possible channels. |
Example HTTP request
- Request an intent token
- Request an intent token with channels
cURL code sample for requesting an intent token
curl "https://$instance.mauth.nevis.cloud/api/v1/intent" \
-XPOST \
-H "Authorization: Bearer $access_key" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d "{ \"username\":\"$username\",
\"operation\":\"enroll\" }"
cURL code sample for requesting an intent token with channels
curl "https://$instance.mauth.nevis.cloud/api/v1/intent" \
-XPOST \
-H "Authorization: Bearer $access_key" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d "{ \"username\":\"$username\",
\"operation\":\"approve\",
\"channels\": [\"push\",\"sms\"] }"
HTTP response
Field | Type | Description |
---|---|---|
token | string | An intent token that has the user and the purpose encoded. It is a one-time token to complete the transaction with the Authentication Cloud API. |
Example HTTP response
200 OK
{
"token":"eyJhb...ZgP_8NBw"
}