Skip to content

Get Current User Token

Description

This operation retrieves the user-token for the currently logged in user. The authorization token or user-token is used to maintain the user session, and it uniquely identifies both the user and the session on the server and is used to enforce security policy, apply user and roles permissions and track usage analytics. User token is not stored in the Users data table, but is uniquely generated on every successful login.

Method

Backendless.UserService.getCurrentUserToken(): Promise<string>;

Return Value

The current user-token. If the user is not logged in, then null is returned.

Example

The example below retrieves the current user token.

Backendless.UserService.getCurrentUserToken()

Codeless Reference

user_service_codeless_get_current_user_token

Returns the current user-token. If the user is not logged in, then null is returned.

Consider the following record in the Users data table:
user_service_codeless_example_get_current_user_2

The example below logs in as "alice@wonderland.com", and retrieves the current user-token.

user_service_codeless_example_get_current_user_token_4

The output will look as shown below after the Codeless logic runs:

B2752110-5588-4F67-831E-AB458D7511F5