Skip to main content

user_tokens

Creates, updates, deletes, gets or lists a user_tokens resource.

Overview

Nameuser_tokens
TypeResource
Idvercel.authentication.user_tokens

Fields

The following fields are returned by SELECT queries:

Successful response.

NameDatatypeDescription
tokenobjectAuthentication token metadata.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_auth_tokenselecttokenIdRetrieve metadata about an authentication token belonging to the currently authenticated User.
list_auth_tokensselectRetrieve a list of the current User's authentication tokens.
create_auth_tokeninsertteamId, data__nameCreates and returns a new authentication token for the currently authenticated User. The bearerToken property is only provided once, in the response body, so be sure to save it on the client for use with API requests.
delete_auth_tokendeletetokenIdInvalidate an authentication token, such that it will no longer be valid for future HTTP requests.
_list_auth_tokensexecRetrieve a list of the current User's authentication tokens.
verify_tokenexectokenemail, tokenName, ssoUserId, teamName, teamSlug, teamPlanVerify the user accepted the login request and get a authentication token. The user email address and the token received after requesting the login must be added to the URL as a query string with the names email and token.
email_loginexecemailRequest a new login for a user to get a token. This will respond with a verification token and send an email to confirm the request. Once confirmed you can use the verification token to get an authentication token.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
teamIdstringThe Team identifier or slug to perform the request on behalf of.
tokenstringThe token returned when the login was requested.
tokenIdstringThe identifier of the token to invalidate. The special value "current" may be supplied, which invalidates the token that the HTTP request was authenticated with.
emailstringEmail to verify the login.
ssoUserIdstringThe SAML Profile ID, when connecting a SAML Profile to a Team member for the first time.
teamNamestringThe name of this user's team.
teamPlanstringThe plan for this user's team (pro or hobby).
teamSlugstringThe slug for this user's team.
tokenNamestringThe desired name for the token. It will be displayed on the user account details.

SELECT examples

Retrieve metadata about an authentication token belonging to the currently authenticated User.

SELECT
token
FROM vercel.authentication.user_tokens
WHERE tokenId = '{{ tokenId }}' -- required
;

INSERT examples

Creates and returns a new authentication token for the currently authenticated User. The bearerToken property is only provided once, in the response body, so be sure to save it on the client for use with API requests.

INSERT INTO vercel.authentication.user_tokens (
data__name,
data__expiresAt,
teamId
)
SELECT
'{{ name }}' /* required */,
{{ expiresAt }},
'{{ teamId }}'
RETURNING
bearerToken,
token
;

DELETE examples

Invalidate an authentication token, such that it will no longer be valid for future HTTP requests.

DELETE FROM vercel.authentication.user_tokens
WHERE tokenId = '{{ tokenId }}' --required
;

Lifecycle Methods

Retrieve a list of the current User's authentication tokens.

EXEC vercel.authentication.user_tokens._list_auth_tokens 

;