This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
OAuth 2.0 Playground with WSO2 Identity Server
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 from 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. Then you need to download the WSO2 Identity Server from here.
- Start the WSO2 Identity Server.
- Sign in. Enter your username and password to log on to the Management Console.
- Click the Main button to access the Manage menu.
- From the Manage menu, select OAuth.
- Click on the Register New Application link on the OAuth Management page.
- Select OAuth 2.0 as the OAuth Version.
- Provide an Application Name and any Callback Url. For the sample to work, use
http://localhost:8080/playground/oauth2client
. - Once you click on Add you are taken to the OAuth Management page once again.
- Click on the application you just created.
- 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.
- Once this is done, use the following link to navigate to the web app:
http://localhost:8080/playground
. - In the playground, click on Import Photos.
- Execute the OAuth flow by selecting the Grant Type you want.
- Click Authorize.
- WSO2 Identity Server requests access to myscope. Login using your credentials.
- To obtain an access token, enter the value for the Access Token Endpoint and Client Secret and click Get Access Token.
- 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.