Skip to main content

GenerateToken

Generate random token which can be used for authorization.

Parameters

Details

This command generates a unique token that can be assign to a user to allow access without using a password. See Authenticate for usage.

This allows management of an account without sharing a password. See UpdateUser for adding and removing tokens.

Examples

First, generate a token:


[{
"GenerateToken": {
}
}]

The result is a new token.


[{
"GenerateToken": {
"status": 0,
"token": "adbp_TxchBKOyerwLEbNnnhuoxtzSuC8ag0u9j5O"
}
}]

This token can then be assigned to a user.


[{
"UpdateUser": {
"username": "john",
"add_tokens": ["adbp_TxchBKOyerwLEbNnnhuoxtzSuC8ag0u9j5O"]
}
}]

Result of successfully assigning a token to a user:


[{
"UpdateUser": {
"status": 0
}
}]

Later, a token can be removed from a user as well:


[{
"UpdateUser": {
"username": "john",
"remove_tokens": ["adbp_TxchBKOyerwLEbNnnhuoxtzSuC8ag0u9j5O"]
}
}]

Result of successfully removing a token:


[{
"UpdateUser": {
"status": 0
}
}]