||
Skip to end of metadata
Go to start of metadata

OAuth core specification supports the following four grant types:

  • Authorization Code Grant (authorization_code)
  • Implicit Grant
  • Resource Owner Password Credentials Grant (password)
  • Client Credentials Grant (client_credentials)

First you need to setup the sample web app. You can download it here and host it in Tomcat. This can be found at http://localhost:8080/playground. If the Identity Server is not running on 9443 - then you need to edit the web.xml of the web app appropriately. Click here to download the WSO2 Identity Server.

  1. Start the WSO2 Identity Server.
  2. Sign in by entering your username and password to log on to the Management Console.
  3. Click the Main button to access the Manage menu and select OAuth.
  4. Click on the Register New Application link on the OAuth Management page.
  5. Select OAuth 2.0 as the OAuth Version.
  6. Provide an Application Name and any Callback Url. For the sample to work, use http://localhost:8080/playground/oauth2client. Here you can select allowed grant types (By default all grant types are activated).  
  7. Once you click Add you are taken to the OAuth Management page once again.
  8. Click on the application you just created.
  9. Copy the values of Client ID, Client Secret, Access Token URL and Authorize URL -- you may need these values later during different stages in the web app.
  10. Once this is done, use the following link to navigate to the web app: http://localhost:8080/playground.
  11. In the playground, click on Import Photos.
  12. Execute the OAuth flow by selecting the Grant Type you want.
  13. Click Authorize.
  14. WSO2 Identity Server requests access to myscope. Login using your credentials.
  15. To obtain an access token, enter the value for the Access Token Endpoint and Client Secret and click Get Access Token.
  16. Click Get Photos.

You can download the complete code of sample web application from here.

From the root level type "mvn clean install" to build it.

 

  • No labels