.. _GenerateToken: GenerateToken ============= Generate a personal token that can later be assigned to a user. Requires a valid session, with no additional permissions. No input or output blobs are used. Parameters ---------- This command takes an empty object. Behavior -------- The generated token grants no access until an administrator assigns it using :doc:`UpdateUser`. Keep the full value securely; inspection later returns only its first 13 characters as a tag. Personal tokens remain usable until removed from their user or the user is deleted. Response -------- Success returns ``status: 0`` and ``token``, a new value with the ``adbp_`` prefix. Failures return a negative ``status`` and an ``info`` message; see :doc:`../Responses` for error envelopes and retry guidance. Examples -------- Generate a personal token: .. TESTED_EXAMPLE: GenerateToken_1 .. code-block:: json [{ "GenerateToken": { } }] Response: .. TESTED_EXAMPLE: GenerateToken_1_response .. code-block:: json [{ "GenerateToken": { "status": 0, "token": "adbp_TxchBKOyerwLEbNnnhuoxtzSuC8ag0u9j5O" } }] Assign it to an existing user: .. TESTED_EXAMPLE: GenerateToken_2 .. code-block:: json [{ "UpdateUser": { "username": "john", "add_tokens": ["adbp_TxchBKOyerwLEbNnnhuoxtzSuC8ag0u9j5O"] } }] Response: .. TESTED_EXAMPLE: GenerateToken_2_response .. code-block:: json [{ "UpdateUser": { "status": 0 } }] Revoke the personal token: .. TESTED_EXAMPLE: GenerateToken_3 .. code-block:: json [{ "UpdateUser": { "username": "john", "remove_tokens": ["adbp_TxchBKOyerwLEbNnnhuoxtzSuC8ag0u9j5O"] } }] Response: .. TESTED_EXAMPLE: GenerateToken_3_response .. code-block:: json [{ "UpdateUser": { "status": 0 } }]