access_token
) is an opaque string representing an authorization issued to the application. It may denote an identifier used to retrieve the authorization information or may self-contain the authorization information (for example, the user’s identity, permissions, and so forth) in a verifiable manner.
It is quite common for Access Tokens to be implemented as JSON Web Tokens.
For more information on Auth0 Access Tokens refer to Access Token.
An API can enforce fine-grained control over who can access the various endpoints exposed by the API. These permissions are expressed as scopes.
When a user authorizes a client application, the application can also indicate which permissions it requires. The user is then allowed to review and grant these permissions. These permissions are then included in the Access Token as part of the scope
claim.
Subsequently, when the client passes along the Access Token when making requests to the API, the API can inspect the scope
claim to ensure that the required permissions were granted in order to call the particular API endpoint.
read:timesheets
), creating timesheets (scope create:timesheets
), deleting timesheets (scope delete:timesheets
) and approving timesheets (scope approve:timesheets
).
When a client asks the API to create a new timesheet entry, then the Access Token should contain the create:timesheets
scope. In a similar fashion, in order to delete existing timesheets, the Access Token should contain the delete:timesheets
scope.
For more information on scopes refer to Scopes.
By using the OAuth 2.0 authorization framework, you can give your own applications or third-party applications limited access to your APIs on behalf of the application itself. Using Auth0, you can easily support different flows in your own APIs without worrying about the OAuth 2.0/OpenID Connect (OIDC) specification, or the many other technical aspects of API authorization.
authorization_code
. This happens because the application, which is typically a JavaScript app running within a browser, is less trusted than a web app running on the server, hence cannot be trusted with the client_secret
(which is required in the Authorization Code Grant).
Once the user authenticates, the application receives the ID Token and Access Token in the hash fragment of the URI. The application can now use the ID Token to obtain information about the user, and Access Token to call the API on behalf of the user.