Implicit Grant with OAuth 2.0 Playground¶
This page guides you through using a sample Playground application to try out authentication to an OAuth 2.0/OpenID Connect web application using the Implicit grant type.
Set up the sample application¶
Download Apache Tomcat 8.x and install it. Tomcat server installation location will later be referred to as
<TOMCAT_HOME>in this guide.
It is recommended that you use a hostname that is not
localhostto avoid browser errors. Modify your machine's
/etc/hostsentry to reflect this.
wso2is.localis used in this documentation as an example, but you must modify this when configuring the authenticators or connectors with this sample application.
Download the sample¶
To deploy a WSO2 Identity Server sample application, you need download the
playground2.war file from the latest release assets.
Deploy the sample web app¶
To deploy the sample web app on a web container:
Copy the downloaded
playground2.warfile into the
Start the Tomcat server.
Access the applcation through this URL:
By default, Tomcat runs on port 8080. If you have configured it to run on a different port, update the URL and access the playground application.
You will now be redirected to the landing page of the sample application.
If you are getting the following error, the sample applications do not have a keystore in them. Therefore, you may get this error after changing the tomcat hostname because the public key of the WSO2 Identity Server does not exist in the Java certificate store.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Register a service provider¶
On WSO2 Identity Server Management Console, go to Main > Identity > Service Providers and click Add.
playground2as the Service Provider Name text box, and click Register.
Expand the Inbound Authentication Configuration > OAuth/OpenID Connect Configuration and click Configure.
Fill in the form that appears. By default, all Allowed Grant Types are selected; you can disable the grant types that are not required.
The custom grant type will only appear on the UI if you have configured the JWT grant type. The value specified as the
deployment.tomlfile when creating the custom grant type is the value that will appear on the UI. For more information on writing a custom grant type, see Write a Custom OAuth 2.0 Grant Type.
Enter the Callback Url as
For more information on other advanced configurations refer, Advanced OpenID Connect.
Click Add. Note that
client secretare generated.
Try Implicit grant¶
Enter the following details.
Authorization Grant Type: Implicit
Client ID: The OAuth Client Key received when registering the service provider.
The playground application will send an authorization request to the authorize endpoint of the WSO2 Identity Server using the following format.
https://<host>:<port>/oauth2/authorize?response_type=token &client_id=<client-ID> &redirect_uri=<callback-url> &scope=<scope>
https://localhost:9443/oauth2/authorize?response_type=id_token+token &client_id=Cx4LKFNObeuXocx7xgOpz5vfzFoa &redirect_uri=http://wso2is.local:8080/playground2/oauth2client &scope=openid
Log in with user credentials (e.g., admin/admin). At this point, the application receives the ID token.