1
votes

Found samples for Custom grant, password and credentials. Is there some sample (nodejs, curl, java or any other option) that you can test the authorization code with the playground2?

2

2 Answers

1
votes

Alternatively, you can try the Authorization Code grant type in the browser without having to use any web app. I wrote a blog post on how to do it [1]

You can test the authorization grant with a combination of a browser redirect and a curl command. The step by step guide with screenshots to achieving this is explained in the blog post.

Let me explain the summary of steps here,

  1. Log in to Identity Server (5.1.0 or higher)
  2. Create a Service Provider and enable Inbound OAuth Authentication
  3. Provide the callback URL as "https://localhost/callback"
  4. Open a private window in a browser and type in the below URL. Replace {client_id} with the client_id of the OAuth client_id of the Service Provider

https://localhost:9443/oauth2/authorize?response_type=code&client_id={client_id}&redirect_uri=https://localhost/callback&scope=read

  1. Next, you will be prompted to login and thereafter to approve for consent.

  2. You will be redirected with the authorization code as "code" query param in the URL

  3. Use a CURL request to the token endpoint to get a valid access token

curl -k -v --user {client_id}:{client_secret} -d "grant_type=authorization_code&code={authorization_code}&redirect_uri=https://localhost/callback" https://localhost:9443/oauth2/token

(replace {client_id},{client_secret} and {authorization_code} with correct values)

You can refer [1] for screenshots.

[1] http://blog.farazath.com/2016/05/trying-out-oauth2-authorization-code.html

0
votes

You can quickly download and spin up an IS 5.0.0 and then configure it with the Info Recovery Sample.

https://docs.wso2.com/display/IS500/Recovering+Account+Information+Using+a+Webapp

The sample is a simple self service account management tool.