Get Access Token
Request URL
PUT /token
Description
This endpoint allows the user to request a token from the server. The token is a long random string and must be provided for all following calls as a header element named token
.
The token and user ID are stored locally for use while this user is logged in.
Credentials
The credentials required to obtain the token may vary depending on the source of the request. Some examples of credentials:
{ //credentials for a web channel
"userName":"ali",
"password":"qa",
"channel":"internet"
}
{ //credentials for a mobile app
"uuid":"unique id of the device",
"deviceTagOpen":"a string generated on the mobile phone",
"channel":"android",
"specifics": {
"serial":"SN of the phone",
"platform":"whatever",
"model":"SONY"
}
}
{ //credentials for a demo test
"channel": "test",
"deviceTag":"my_deviceTag",
"deviceData": {
"platform": "test"
}
}
Schema
Property table for schema 1 for token
Property | Description | Required | Schema |
---|---|---|---|
channel | The channel through which the request is received | Yes | { "type": "string", "enum": [ "internet" ] } |
userName | The username of the user | Yes | { "type": "string" } |
password | The password of the user | Yes | { "type": "string" } |
Property table for schema 2 for token
Property | Description | Required | Schema |
---|---|---|---|
channel | The channel through which the request is received | Yes | { "type": "string", "enum": [ "android" ] } |
uuid | The Universally Unique Identifier (UUID) for the device, 36 character string containing numbers, letters, and dashes | Yes | { "type": "string" } |
deviceTagOpen | The device tag | Yes | { "type": "string" } |
signature | signature | Yes | { "type": "string" } |
Property table for schema 3 for token
Property | Description | Required | Schema |
---|---|---|---|
channel | The channel through which the request is received | Yes | { "type": "string", "enum": [ "browser" ] } |
deviceId | Device ID | Yes | { "type": "string" } |
Property table for schema 4 for token
Property | Description | Required | Schema |
---|---|---|---|
channel | The channel through which the request is received | Yes | { "type": "string", "enum": [ "statementGenerator", "dicBuilder" ] } |
userId | The user id (also referred to as AFiUserId) | Yes | { "type": "string" } |
Property table for schema 5 for token
Property | Description | Required | Schema |
---|---|---|---|
channel | The channel through which the request is received | Yes | { "type": "string", "enum": [ "chat" ] } |
transportUserId | The device ID for the chat channel | Yes | { "type": "string" } |
transport | The device type for the chat channel | Yes | { "type": "string" } |
Property table for schema 6 for token
Property | Description | Required | Schema |
---|---|---|---|
channel | The channel through which the request is received | Yes | { "type": "string", "enum": [ "android_v1", "mobile", "ios_v1" ] } |
deviceTag | The device tag (id) | Yes | { "type": "string" } |
dtsValueString | The date/time stamp for the request | Yes | { "type": "string" } |
cryptotext | Cryptotext for the device | Yes | { "type": "string" } |
Property table for schema 7 for token
Property | Description | Required | Schema |
---|---|---|---|
channel | The channel through which the request is received | Yes | { "type": "string", "enum": [ "test" ] } |
deviceTag | The device tag (id) | Yes | { "type": "string" } |
dtsValueString | The date/time stamp for the request | Yes | { "type": "string" } |
Request Body
Snippet Examples
javascript
const axios = require('axios');
const data = {
"channel": "test",
"deviceTag":"my_deviceTag",
"deviceData": {
"platform": "test"
}
};
const config = {
method: 'PUT',
url: '${AMPLIFI_BASE_URL}/token',
headers: {
'Content-Type': "application/json"
},
data
};
let result;
try {
result = await axios.request(config);
if (result.status === 200) {
console.log(JSON.stringify(result.data));
}
} catch (err) {
console.log({
errCode: err.code,
responseStatus: err.response && err.response.status,
data: err.response && JSON.stringify(err.response.data)
});
}
cURL
curl --location "AMPLIFI_BASE_URL/token" --data "{\"channel\":\"test\", \"deviceTag\":\"my_deviceTag\", \"deviceData\":{ \"platform\":\"test\" }}" --header "Content-Type: application/json"
Successful Response Examples
200 TOKEN LOGIN SUCCESSFUL RESPONSE TEST LOGIN
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
REQUEST BODY
RESPONSE BODY