mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
1.8 KiB
1.8 KiB
@logto/console | @logto/core | @logto/phrases | @logto/schemas |
---|---|---|---|
minor | minor | minor | minor |
Add personal access token (PAT)
Personal access tokens (PATs) provide a secure way for users to grant access tokens without using their credentials and interactive sign-in.
You can create a PAT by going to the user's detail page in Console or using the Management API POST /users/:userId/personal-access-tokens
.
To use a PAT, call the token exchange endpoint POST /oidc/token
with the following parameters:
grant_type
: REQUIRED. The value of this parameter must beurn:ietf:params:oauth:grant-type:token-exchange
indicates that a token exchange is being performed.resource
: OPTIONAL. The resource indicator, the same as other token requests.scope
: OPTIONAL. The requested scopes, the same as other token requests.subject_token
: REQUIRED. The user's PAT.subject_token_type
: REQUIRED. The type of the security token provided in thesubject_token
parameter. The value of this parameter must beurn:logto:token-type:personal_access_token
.client_id
: REQUIRED. The client identifier of the client application that is making the request, the returned access token will contain this client_id claim.
And the response will be a JSON object with the following properties:
access_token
: REQUIRED. The access token of the user, which is the same as other token requests likeauthorization_code
orrefresh_token
.issued_token_type
: REQUIRED. The type of the issued token. The value of this parameter must beurn:ietf:params:oauth:token-type:access_token
.token_type
: REQUIRED. The type of the token. The value of this parameter must beBearer
.expires_in
: REQUIRED. The lifetime in seconds of the access token.scope
: OPTIONAL. The scopes of the access token.