Create access token
Create a new access token for a client.
Authorization
In: header
Request Body
application/json
OptionalThe expiration date and time of the access token in seconds. Cannot be more than 48 hours. The shorter the duration, the more secure it is.
When true, the access token header type will be set to jwt
instead of at+jwt
.
When true, the audience will be set as an array instead of a string.
When true, the default domain will be used in the issuer field.
Path Parameters
Unique identifier for a provider.
"uuid"
Unique identifier for a client.
"uuid"
Response Body
Token created successfully.
TypeScript Definitions
Use the response body type in TypeScript.
JWT token.
Expiration date and time of the access token.
Type of the token.
Invalid request parameters.
TypeScript Definitions
Use the response body type in TypeScript.
Missing or invalid or expired auth token.
TypeScript Definitions
Use the response body type in TypeScript.
Resource not found.
TypeScript Definitions
Use the response body type in TypeScript.
Internal server error.
TypeScript Definitions
Use the response body type in TypeScript.
curl -X POST "https://sdk.usegrant.dev/v1/providers/497f6eca-6276-4993-bfeb-53cbbbba6f08/clients/497f6eca-6276-4993-bfeb-53cbbbba6f08/tokens" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"expiresIn": 0,
"useJwtType": true,
"audienceAsArray": true,
"forceDefaultDomain": true
}'
const body = JSON.stringify({
"expiresIn": 0,
"useJwtType": true,
"audienceAsArray": true,
"forceDefaultDomain": true
})
fetch("https://sdk.usegrant.dev/v1/providers/497f6eca-6276-4993-bfeb-53cbbbba6f08/clients/497f6eca-6276-4993-bfeb-53cbbbba6f08/tokens", {
headers: {
"Authorization": "Bearer <token>"
},
body
})
package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://sdk.usegrant.dev/v1/providers/497f6eca-6276-4993-bfeb-53cbbbba6f08/clients/497f6eca-6276-4993-bfeb-53cbbbba6f08/tokens"
body := strings.NewReader(`{
"expiresIn": 0,
"useJwtType": true,
"audienceAsArray": true,
"forceDefaultDomain": true
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import requests
url = "https://sdk.usegrant.dev/v1/providers/497f6eca-6276-4993-bfeb-53cbbbba6f08/clients/497f6eca-6276-4993-bfeb-53cbbbba6f08/tokens"
body = {
"expiresIn": 0,
"useJwtType": true,
"audienceAsArray": true,
"forceDefaultDomain": true
}
response = requests.request("POST", url, json = body, headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
})
print(response.text)
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"expiresAt": "2024-01-01T00:00:00Z",
"type": "Bearer"
}
{
"code": "string",
"message": "string"
}
{
"code": "string",
"message": "string"
}
{
"code": "string",
"message": "string"
}
{
"code": "string",
"message": "string"
}