By Marone: May 2020

Obtain AccessToken From OpenAM

Goal

In the previous article we 've seen how to run OpenAM COMMUNITY EDITION and how to create a Realm.
In Order to obtain access token there is may steps have to be done:
First, we will configure the OAuth2 Provider. Second, we will create and configure a OAuth 2.0/OpenID Connect Client, than we will add a test user. At the end we will use curl command to request a access token

Used technologies

OpenAM 14.5.1
Docker 19.x (Running on Windows)
Curl 7.65

Configure OAuth2 Provider

In the AM console, navigate to Realm: testRealm

Realm dashboard In Dashboard go to: Configure OAuth Provider > Configure OpenID Connect.
On Configure OAuth2/OpenID Connect Service page, the realm will be testRealm, if not you can select the realm

Create OAuth 2.0/OpenID Connect Client

Inside realm in left menu, go to Applications -> OAuth 2.0 and create New Agent.
Set name for example testclient, and set a password.
Click Create to save.

OpenID Connect client
Now Click testclient to open the OAuth 2.0 Client settings page.
Under Scope(s) add New Value = cn and click Add. Click save button in the top right corner.

add scope cn

Add user

Inside realm Dashboard in left menu, go to Subjects and create New User.
Set ID: johndoe
Set First Name: john
Set Last Name: doe
Set Full Name: johndoe
Set a password, make sure that User Status is Active
Click Create to save.

Access Token



References