Register OAuth 2.0 clients in AM
The OAuth 2.0 client profile defines how an application connects to AM to obtain OAuth 2.0 tokens.
To allow the SDKs to connect to AMd and obtain OAuth 2.0 tokens, you must register an OAuth 2.0 client application.
There are two types of OAuth 2.0 client:
- Public client
-
Public clients do not use a client secret to obtain tokens because they are unable to keep them hidden. The ForgeRock SDKs commonly use this type of client to obtain tokens, as they cannot guarantee safekeeping of the client credentials in a browser or on a mobile device.
- Confidential client
-
Confidential clients are able to store credentials securely and are commonly used for server-to-server communication.
Only the following tutorials and integrations require a confidential client:
Register a public OAuth 2.0 client
To register a public OAuth 2.0 client application for use with the SDKs in AM, follow these steps:
-
Log in to the AM admin UI as an administrator.
-
Navigate to Applications > OAuth 2.0 > Clients, and then click Add Client.
-
In Client ID, enter
sdkPublicClient
. -
Leave Client secret empty.
-
In Redirection URIs, enter the following values:
https://sdkapp.example.com:8443/callback https://com.example.reactnative.todo/callback https://com.example.flutter.todo/callback https://localhost:8443/callback.html
The ForgeRock SDK for JavaScript attempts to load the redirect page to capture the OAuth 2.0
code
andstate
query parameters that the server appended to the redirect URL.If the page you redirect to does not exist, takes a long time to load, or runs any JavaScript you might get a timeout, delayed authentication, or unexpected errors.
To ensure the best user experience, we highly recommend that you redirect to a static HTML page with minimal HTML and no JavaScript when obtaining OAuth 2.0 tokens.
Also add any other domains where you will be hosting SDK applications. -
In Scopes, enter the following values:
openid profile email address
-
Click Create.
AM creates the new OAuth 2.0 client, and displays the properties for further configuration.
-
On the Core tab:
-
In Client type, select
Public
. -
Disable Allow wildcard ports in redirect URIs.
-
Click Save Changes.
-
-
On the Advanced tab:
-
In Grant Types, enter the following values:
Authorization Code Refresh Token
-
In Token Endpoint Authentication Method, select
None
. -
Enable the Implied consent property.
-
-
Click Save Changes.
Register a confidential OAuth 2.0 client
The following tutorials and integrations require a confidential client:
To register a confidential OAuth 2.0 client application for use with the SDKs in AM, follow these steps:
-
Log in to the AM admin UI as an administrator.
-
Navigate to Applications > OAuth 2.0 > Clients, and then click Add Client.
-
In Client ID, enter
sdkConfidentialClient
. -
In Client Secret, enter a strong password and make a note of it for later use.
The client secret is not available to view after this step.
If you forget it, you must reset the secret and reconfigure any connected clients.
-
In Default Scopes, enter
am-introspect-all-tokens
.AM creates the new OAuth 2.0 client and displays the properties for further configuration.
-
On the Advanced tab:
-
Enable the Implied consent property.
-
-
Click Save Changes.