This is the second section in the WSO2 Identity Server documentation related to OAuth 2.0 grant types in WSO2 API Manager (WSO2 Carbon platform). To attain a more complete understanding of this section, read and work on the examples described here.
Before attempting to work on the sample, look through the steps involved in implicit grant type.
The application (client) requests for a token from the authorization server by sending a HTTP GET request with the following query parameters.
The first two are mandatory parameters while the last two can be optional.
- Upon receiving the request, the authorization server must return a 302 redirection back to the client with a Location header pointing to the URL of user consent page. (e.g.:- Location:
- The resource owner confirms the authorization requested by client (application) by specifying the required credentials.
- The authorization server redirects the user back to the application (to the Callback URL which has been specified at the first step) with the access token.
The following steps expand more on the above procedure using the sample web application (this acts as the client/application) and WSO2 API Manager (acts as the authorization server).
Access the OAuth playground application as instructed here. Once you click on the Import Photos icon, you are directed to a screen with a form with various options such as Authorization Grant Type, Client Id etc.
- Select Implicit as the Authorization Grant Type.
- Copy the Consumer Key value from the application you have subscribed in WSO2 API Manager and enter it in Client Id text box.
- Specify any string value as scope. The scope attribute is not relevant in this example.
- Enter the Callback URL which must be identical to the value you have specified at the time of creating the new application in WSO2 API Manager. E.g.:- http://localhost:8090/playground2.0/oauth2client
- Enter the Authorize endpoint. This should be the endpoint of the authorization server where it accepts the authorization requests. In WSO2 API Manager, there is an API to handle all authorization requests and it can be accessed through
- Once you have completed adding all values in the form in the playground app, click on Authorize.
This generates an HTTP GET request similar to the following. You can see it contains all mandatory URL parameters which were discussed in under the general introduction of "Implicit grant type".
- When you click on Authorize with all required parameters, the application generates the above HTTP GET call and you are redirected to the user consent screen as shown below.
- Click on Authorize. You are provided with options to enter the username and password (username and password of the resource owner/end user).
- Login as an admin.
- You receive the Access Token as shown below.
- Now, you can use this Access Token to perform the actual API call.