Implicit grant type is used to obtain access tokens if your application (client) is a mobile application or a browser based app such as a JavaScript client. Similar to authorization code grant, the implicit grant type is also based on redirection flow. The redirection URI includes the access token in the URI fragment. Therefore, the client application is capable of interacting with the resource owner user agent to obtain the access token from the redirection URI which is sent from the authorization server.
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 is authenticated by the authorization server to obtain the access token. The access token is encoded into the redirection URI. This may be exposed to the resource owner and other applications residing inside 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, and other optional parameters.
Since the resource owner authenticates directly with the authorization server, their 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.
Note |
---|
The refresh token will not be issued for the client with this grant, as the client type is public. Also note that, the implicit Implicit grant does not include client authentication because it does not make use of the client secret .of the application |
Invoking the Token API to generate tokens
...
- Login to WSO2 API Manager Store and create an application as shown below.
Go to production the Production keys tab in for the created application, . Add http://localhost:8080/playground2/oauth2client as the callback URL, select implicit the Callback URL. Select Implicit from the list of grant type list and types and click Generate Keys.
Note By default the implicit and code The Implicit grant and Code grant type selection checkboxes are disabled by default in the UI. You need to To enable selecting the checkboxes, enter the callback URL first to enable selecting the implicit grant typeCallback URL for the application.
- 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 https://localhost:8243/oauth2/authorize
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
Note |
---|
Note that for For users to be counted in the Registered Users for Application statistics, which takes the number of users shared each of the Application, they should have to generate access tokens using Password Grant type. |