user_tokens
Creates, updates, deletes, gets or lists a user_tokens
resource.
Overview
Name | user_tokens |
Type | Resource |
Id | vercel.authentication.user_tokens |
Fields
The following fields are returned by SELECT
queries:
- get_auth_token
- list_auth_tokens
Successful response.
Name | Datatype | Description |
---|---|---|
token | object | Authentication token metadata. |
Authentication token metadata.
Name | Datatype | Description |
---|---|---|
id | string | The unique identifier of the token. (example: 5d9f2ebd38ddca62e5d51e9c1704c72530bdc8bfdd41e782a6687c48399e8391) |
name | string | The human-readable name of the token. |
activeAt | number | Timestamp (in milliseconds) of when the token was most recently used. |
createdAt | number | Timestamp (in milliseconds) of when the token was created. |
expiresAt | number | Timestamp (in milliseconds) of when the token expires. |
origin | string | The origin of how the token was created. (example: github) |
scopes | array | The access scopes granted to the token. |
type | string | The type of the token. (example: oauth2-token) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_auth_token | select | tokenId | Retrieve metadata about an authentication token belonging to the currently authenticated User. | |
list_auth_tokens | select | Retrieve a list of the current User's authentication tokens. | ||
create_auth_token | insert | teamId , data__name | 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. | |
delete_auth_token | delete | tokenId | Invalidate an authentication token, such that it will no longer be valid for future HTTP requests. | |
_list_auth_tokens | exec | Retrieve a list of the current User's authentication tokens. | ||
verify_token | exec | token | email , tokenName , ssoUserId , teamName , teamSlug , teamPlan | Verify 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_login | exec | email | Request 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.
Name | Datatype | Description |
---|---|---|
teamId | string | The Team identifier or slug to perform the request on behalf of. |
token | string | The token returned when the login was requested. |
tokenId | string | The identifier of the token to invalidate. The special value "current" may be supplied, which invalidates the token that the HTTP request was authenticated with. |
email | string | Email to verify the login. |
ssoUserId | string | The SAML Profile ID, when connecting a SAML Profile to a Team member for the first time. |
teamName | string | The name of this user's team. |
teamPlan | string | The plan for this user's team (pro or hobby). |
teamSlug | string | The slug for this user's team. |
tokenName | string | The desired name for the token. It will be displayed on the user account details. |
SELECT
examples
- get_auth_token
- list_auth_tokens
Retrieve metadata about an authentication token belonging to the currently authenticated User.
SELECT
token
FROM vercel.authentication.user_tokens
WHERE tokenId = '{{ tokenId }}' -- required
;
Retrieve a list of the current User's authentication tokens.
SELECT
id,
name,
activeAt,
createdAt,
expiresAt,
origin,
scopes,
type
FROM vercel.authentication.user_tokens
;
INSERT
examples
- create_auth_token
- Manifest
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
;
# Description fields are for documentation purposes
- name: user_tokens
props:
- name: teamId
value: string
description: Required parameter for the user_tokens resource.
- name: name
value: string
- name: expiresAt
value: number
DELETE
examples
- delete_auth_token
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
- _list_auth_tokens
- verify_token
- email_login
Retrieve a list of the current User's authentication tokens.
EXEC vercel.authentication.user_tokens._list_auth_tokens
;
Verify 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
.
EXEC vercel.authentication.user_tokens.verify_token
@token='{{ token }}' --required,
@email='{{ email }}',
@tokenName='{{ tokenName }}',
@ssoUserId='{{ ssoUserId }}',
@teamName='{{ teamName }}',
@teamSlug='{{ teamSlug }}',
@teamPlan='{{ teamPlan }}'
;
Request 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.
EXEC vercel.authentication.user_tokens.email_login
@@json=
'{
"email": "{{ email }}",
"tokenName": "{{ tokenName }}"
}'
;