authenticateByTicket
Syntax
authenticateByTicket(ticket)
Details
Logs in using a session ticket. Since version 3.00.6.3, persistent access tokens are also supported.
Arguments
ticket is a STRING scalar that can be a session ticket generated by getAuthenticatedUserTicket or generateUserTicket, or an access token generated by createAccessToken.
Returns
None.
Examples
Example 1. Log in using a session ticket
accountName = getCurrentSessionAndUser()[1]
ticket1 = getAuthenticatedUserTicket(expire=2030.12.31T12:00:00)
// Log in using the session ticket
logout()
authenticateByTicket(ticket=ticket1)
// Verify that the current user is accountName
getCurrentSessionAndUser()[1] == accountName
// output: true
Example 2. Log in using an access token
accountName = getCurrentSessionAndUser()[1]
accessToken = createAccessToken(userId=accountName, expire=2030.12.31T23:59:59, description="MCP client")
// Log in using the access token
logout()
authenticateByTicket(ticket=accessToken["token"])
// Verify that the current user is accountName
getCurrentSessionAndUser()[1] == accountName
// output: true
Related functions: getAuthenticatedUserTicket, generateUserTicket, createAccessToken, revokeAccessToken, listAccessTokens
