This documentation is for WSO2 Identity Server 5.0.0. View documentation for the latest release.
Page Comparison - Writing a Custom OAuth 2.0 Grant Type (v.6 vs v.7) - Identity Server 5.0.0 - WSO2 Documentation

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  1. Copy the .jar file into the <IS_HOME>/repository/component/lib directory. You can also modify the project and build it using Apache Maven 3.
  2. Configure the following in the <IS_HOME>/repository/conf/identity.xml file under the <OAuth><SupportedGrantTypes> element.

    Code Block
  3. Restart the server.

  4. Configure the OAuth grant type you customized.
    1. Sign in to the WSO2 Identity Server. Enter your username and password to log on to the Management Console
    2. Navigate to the Main menu to access the Identity menu. Click Add under Service Providers.
    3. Fill in the Service Provider Name and provide a brief Description of the service provider. See Adding a Service Provider for more information.
    4. Expand the OAuth/OpenID Connect Configuration and click Configure.
    5. Enter a callback url for example http://localhost:8080/playground2/oauth2client and click Add.
    6. The OAuth Client Key and OAuth Client Secret will now be visible.
  5. Send the password grant request to the /token API using a cURL command.

    1. Replace clientid:clientsecret clientsecret with the OAuth Client Key and OAuth Client Secret respectively and run the following sample cURL command in a new terminal window. 

      Code Block
      curl --user clientid:clientsecret -k -d "grant_type=password&username=admin&password=admin" -H "Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token
    2. You will see the following json response and the modified access token with an email address.

      Code Block