/oauth2/token
const url = 'https://gymgym.club/api/auth/oauth2/token';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"grant_type":"example","client_id":"example","client_secret":"example","code":"example","code_verifier":"example","redirect_uri":"https://example.com","refresh_token":"example","resource":["example"],"scope":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gymgym.club/api/auth/oauth2/token \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "grant_type": "example", "client_id": "example", "client_secret": "example", "code": "example", "code_verifier": "example", "redirect_uri": "https://example.com", "refresh_token": "example", "resource": [ "example" ], "scope": "example" }'Obtain an OAuth2.1 access token
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”RFC 9449 DPoP proof JWT for issuing DPoP-bound tokens
Request Bodyrequired
Section titled “Request Bodyrequired”object
OAuth2 grant type
OAuth2 client ID
OAuth2 client secret
Authorization code (for authorization_code grant)
PKCE code verifier (for authorization_code grant)
Redirect URI (for authorization_code grant)
Refresh token (for refresh_token grant)
Single resource (URL)
Multiple resources (URLs)
Requested scopes (for client_credentials grant)
Examplegenerated
{ "grant_type": "example", "client_id": "example", "client_secret": "example", "code": "example", "code_verifier": "example", "redirect_uri": "https://example.com", "refresh_token": "example", "resource": [ "example" ], "scope": "example"}Responses
Section titled “Responses”Access token response
object
The access token issued by the authorization server
The type of the token issued
Lifetime in seconds of the access token
Refresh token, if issued
Scopes granted by the access token
ID Token (if OpenID Connect)
Example
{ "token_type": "Bearer"}Invalid request or error response
object
Examplegenerated
{ "error": "example", "error_description": "example", "error_uri": "example"}Unauthorized. Due to missing or invalid authentication.
object
Examplegenerated
{ "message": "example"}Forbidden. You do not have permission to access this resource or to perform this action.
object
Examplegenerated
{ "message": "example"}Not Found. The requested resource was not found.
object
Examplegenerated
{ "message": "example"}Too Many Requests. You have exceeded the rate limit. Try again later.
object
Examplegenerated
{ "message": "example"}Internal Server Error. This is a problem with the server that you cannot fix.
object
Examplegenerated
{ "message": "example"}