API   ->   Token

xAuthToken


A token serves as the credential that must be provided when calling any API. To obtain a token, you need to send your application information along with user information to a designated endpoint.

Each token is uniquely tied to a specific set of application and user information. This means that one token represents one application-user pair.
If you intend to call the API on behalf of multiple users, you must request and obtain a separate token for each user.

Token is the first step for the APIs.

Example:

{{baseuri}}/getLogin

Parameters:

http method: GET/POST

Developers must cache the x-auth-token for subsequent API calls.

Note: This token retrieval interface should not be called frequently, as excessive calls may lead to frequent interception or throttling.

When the x-auth-token becomes invalid or expires, it is necessary to re-acquire a new token.

Importantly, there is no guarantee that the token remains valid for the entire indicated validity period, so developers should implement robust logic to re-acquire the access_token whenever it becomes invalid.

Additionally, please ensure that at least 256 bytes of storage space is reserved to store the x-auth-token.

Return example

{
	"success":true,
	"systemInfo":{
		"logoPath":"https://www.cubedrive.com/lite/images/customer/REDBEANDATA.png",
		"language":"en",
		"systemName":"CubeDrive",
		"systemDesc":"CubeDrive: application builder",
		"showAppModule":true,
		"showHelpModule":true,
		"canSelfRegister":true
	},
	"userLang":"en",
	"userObj":{
		"id":"14r7AYizW6c",
		"firstname":"John",
		"lastname":"Doe",
		"name":"John Doe",
		"imagepath":"https://www.cubedrive.com/lite/userFile/redbeandata/users/user22/profile/thumb_people-1586059479881.png",
		"description":null,
		"username":"xxxxx",
		"email":"johndoe@cubedrive.com",
		"enabled":null,
		"role":"user",
		"roleId":2,
		"createDate":null,
		"maxApp":null,
		"maxShared":null,
		"maxRecords":null,
		"maxSpace":null
	},
	"x-auth-token": "32997522-0c9f-4336-80fb-fef717e28248"
}
    
Tip: {{author_Encypted_Id}} is the value obtained from above json result: userObj.id. That is it: 14r7AYizW6c.

Use token


After obtaining the token, user can use the API provided by the platform. When calling the API, user only need to add the Authorization request header (Headers) as shown below.

X-Auth-Token: {{xAuthToken}}
please replace {{xAuthToken}} with x-auth-token value.

User can also pass taken as url parameter:

https://www.cubedrive.com/lite/commonPage?page=formData&x-auth-token={{xAuthToken}}


Validate token


The user can query whether the x-auth-token is valid through this interface.

https://www.cubedrive.com/lite/verifyAuthToken?authToken=9e2373f7-b3de-4ad4-9606-59b8c9cb70b6
If it works, the return result as following.
{"success":true,"valid":true}