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¶
- (NSString *)getUserToken;
func getUserToken() -> 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.
NSString *token = [Backendless.shared.userService getUserToken];
let token = Backendless.shared.userService.getUserToken()
Codeless Reference¶

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:
The example below logs in as "alice@wonderland.com", and retrieves the current user-token.

The output will look as shown below after the Codeless logic runs:
B2752110-5588-4F67-831E-AB458D7511F5