Overview
Authlete enables developers to build an authorization page where end-users (or resource owners) can choose scopes. This article describes how to use Authlete APIs to do that.\
Obtaining a list of scopes from an authorization request
First you will need to know which scopes are requested by a client. They are included in an authorization request from the client with a parameter “scope.” Authlete’s /auth/authorization API parses the request and tells your authorization server the requested scopes, as an array of “scopes”. The following is an example request/response.- Request
- Response
Specifying the end user’s chosen scopes
Once the authorization server recognizes the end user’s intent, it will ask Authlete to issue an access token (and/or an authorization code) with the scopes that are chosen by the user. Authlete’s /auth/authorization/issue API accepts a request including “scopes” that enables narrowing down scopes, which are initially requested in the authorization request from the client. By giving a non-empty string array as the value of the scopes parameter, Authlete replaces the scopes with it. The following is an example request/response for processing implicit grant flow.- Request
- Response
Note that this function only narrows down the scopes originally requested at /auth/authorization API. The scopes parameter cannot include additional scopes that you did not request at the /auth/authorization API.