The implicit grant type does not require client authentication, and relies on the presence of the resource owner and the registration of the redirection URI. The resource owner needs to authenticate with the authorization server to obtain the access token. Because the access token is encoded into the redirection URI, it may be exposed to the resource owner and other applications residing in the same device.
The diagram below depicts the flow of Implicit Grant.
The client requests for the access token with the client ID and grant type, with optional parameters.
Since the resource owner authenticates directly with the authorization server, his/her credentials will not be shared with the client.
The Authorization Server sends the Access token through a URI fragment to the client.
The client extracts the token from the fragment and sends the API request to the Resource Server with the access token.
The refresh token will not be issued for the client with this grant, as the client type is public. Also note that, the implicit grant does not include client authentication because it does not make use of client secret.
Invoking the Token API to generate tokens
In this example we use the WSO2 Playground, which is hosted as a web application, to obtain the access token with implicit grant.
Before you begin,
The following instructions use the sample playground webapp. For instructions on how to set up the sample webapp, see Setting up the Sample Webapp.
- Login to WSO2 API Manager Store and create an application as below.
Go to production keys tab in the created application, Add http://localhost:8080/playground2/oauth2client as the callback URL and click Generate Keys.
Make sure you have select implicit from the Grant Types before generating keys.
- Go to playground app http://wso2is.local:8080/playground2/index.jsp and click import photos.
Give the information in the table below and click Authorize.
Field Sample Value Authorization Grant Type Implicit Client Id Consumer Key obtained for your application Scope The scope you have selected for you application Callback URL The callback URL of your application Authorize Endpoint
The playground application redirects to the login page. Enter you username and password and click Sign In.
Click Approve to provide access to your information.
You will receive the access token as follows