You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 12
Next »
Configuring OAuth/OpenID Connect
Configure OAuth/OpenID Connect service provider as described in here.
Configuring the Playground2 web application
To obtain and configure the single sign-on sample, follow the steps below.
You can check out the repository of the OAuth 2.0 sample from GitHub. Follow the instructions here to checkout the folder. We refer <SAMPLE_HOME> as the modules/samples folder inside the folder where the product-is repository is checked out.
https://github.com/wso2/product-is/tree/v5.1.0/modules/samples/oauth2/playground2
In your command line, navigate to <SAMPLE_HOME>/oauth2/playground2
in the folder you checked out and build the sample using the following command. You must have Apache Maven installed to do this (see Installation Prerequisites for the appropriate version to use).
After successfully building the sample, a .war file named playground2 can be found inside the <SAMPLE_HOME>/oauth2/playground2/target folder. Deploy this sample web app on a web container. To do this, use the Apache Tomcat server.
Use the following steps to deploy the web app in the web container:
- Stop the Apache Tomcat server if it is already running.
- Copy the playground2 file to the
<TOMCAT_HOME>/webapps
folder. - Start the Apache Tomcat server.
OAuth 2.0 Grant Types with WSO2 OAuth2 Playground
OAuth 2.0 Authorization code Grant Type with WSO2 OAuth2 Playground
Running the application:
Visit the URL http://localhost:8080/playground2/oauth2.jsp to start the application.
Enter the following details and click Authorize.

Log in with the user credentials.

Click Approve to consent to this action.

Provide the following details and click on Get Access Token.

- At this point the application receives the Access Token.

Click on Get Photos.
Now you should be able to see the user photos.

OAuth 2.0 Implicit Grant Type with WSO2 OAuth2 Playground
Running the application:
- Visit the URL http://localhost:8080/playground2/oauth2.jsp to start the application.
Enter the following details and click Authorize.

- Log in with the user.

- Click Approve to consent to this action.

- At this point the application receives the Access Token.

- Click on Get Photos.
Now you should be able to see the user photos.

OAuth 2.0 Password Grant Type with WSO2 OAuth2 Playground
Running the application:
- Visit the URL http://localhost:8080/playground2/oauth2.jsp to start the application.
Enter the following details and click Authorize.
Authorization Grant Type: Resource Owner
Client ID: (the client id received at the application registration)
Client Secret: (client secret received at the application registration)
Resource Owner User Name: (username)
Resource Owner Password: (password of the user)
Authorize Endpoint: https://localhost:9443/oauth2/token

- At this point the application receives the Access Token.

- Click on Get Photos.
Now you should be able to see the user photos.

OAuth 2.0 Client Credentials Grant Type with WSO2 OAuth2 Playground
Running the application:
- Visit the URL http://localhost:8080/playground2/oauth2.jsp to start the application.
Enter the following details and click Authorize.
Authorization Grant Type: Client Credentials
Client ID: (the client id received at the application registration)
Client Secret: (client secret received at the application registration)
Authorize Endpoint: https://localhost:9443/oauth2/authorize

- At this point the application receives the Access Token.

- Click on Get Photos.
Now you should be able to see the user photos.
