com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Implicit Grant

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, implicit grant type is also based in redirection flow but 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 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.


  1. The client requests for the access token with the client ID and grant type, with optional parameters.

  2. Since the resource owner authenticates directly with the authorization server, his/her credentials will not be shared with the client.

  3. The Authorization Server sends the Access token through a URI fragment to the client.

  4. 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.

The following parameters are required to implement the Implicit grant type in WSO2 API Manager.

NameDescriptionSample value
scope

The OAuth scope you are requesting for the particular token

openid
response_typeThe required response formatid_token
redirect_uri

The URL of the Oauth application requesting for the token

http://localhost:8080/playground2/oauth2client
nonceAny random value13e2312637dg136e1
client_idClient ID of the OAuth applicationmzdQQ0RZOIqAf549ucIImB4h0SIa

An example is given below : 

https://localhost:8243/authorize
scope=openid
&response_type=id_token
&redirect_uri=http://localhost:8080/playground2/oauth2client
&nonce=13e2312637dg136e1
&client_id=mzdQQ0RZOIqAf549ucIImB4h0SIa

Invoking the Token API to generate tokens  

In this example we use the WSO2 Playground, which 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.

  1. Login to WSO2 API Manager Store and create an application as below.
  2. Go to production keys tab in the created application, Add http://localhost:8080/playground2/oauth2client as the callback URL, select implicit form the grant type list and click Generate Keys. 

    By default the implicit and code grant type selection checkboxes are disabled in the UI. You need to enter the callback URL first to enable selecting the implicit grant type.



  3. Go to playground app http://wso2is.local:8080/playground2/index.jsp and click import photos.

  4. Give the information in the table below and click Authorize.

    FieldSample Value
    Authorization Grant TypeImplicit
    Client IdConsumer Key obtained for your application
    ScopeThe scope you have selected for you application
    Callback URLThe callback URL of your application
    Authorize Endpointhttps://localhost:8243/authorize

  5. The playground application redirects to the login page. Enter you username and password and click Sign In.

  6. Click Approve to provide access to your information.

  7. You will receive the access token as follows 

    access-token.png

    Note that 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.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.