oAuth2

The OAuth 2.0 Token Endpoint

Changed on

Use open source libraries to perform OAuth 2.0 and OpenID Connect available for any programming language. You can find a list of libraries here https://oauth.net/code/

This endpoint should not be used via the Ory SDK and is only included for technical reasons. Instead, use one of the libraries linked above.

post/oauth2/token

Request

  • Base URL
    / (relative, and the document was published on a file host, not at the API’s origin)
  • URL
    /oauth2/token
  • Auth
    • HTTP basic
    • or OAuth 2
      Authorization code: https://hydra.demo.ory.sh/oauth2/auth
      Token URL: https://hydra.demo.ory.sh/oauth2/token

Request body application/x-www-form-urlencoded

grant_typestring required
codestring
refresh_tokenstring
redirect_uristring
client_idstring

Response

oAuth2TokenExchange

access_tokenstring

The access token issued by the authorization server.

expires_ininteger

The lifetime in seconds of the access token. For example, the value "3600" denotes that the access token will expire in one hour from the time the response was generated.

id_tokenstring

To retrieve a refresh token request the id_token scope.

refresh_tokenstring

The refresh token, which can be used to obtain new access tokens. To retrieve it add the scope "offline" to your access token request.

scopestring

The scope of the access token

token_typestring

The type of the token issued

Changes

    • info

      api operation id performOAuth2TokenFlow removed and replaced with oauth2TokenExchange

    • info

      api tag oAuth2 added

    • info

      api tag v0alpha2 removed

    • info

      api operation id oauth2Token removed and replaced with performOAuth2TokenFlow

    • info

      api tag v0alpha2 added

    • info

      api tag public removed

    • info

      removed the non-success response with the status

    • info

      removed the non-success response with the status