Configure Ping SDK for JavaScript properties
Configure SDK properties in your JavaScript app by editing a serverConfig object, a parameter of the Config.setAsync() function.
Properties
The following properties are available for configuring the Ping SDK for JavaScript:
Server
| Property | Description |
|---|---|
|
An interface for configuring how the SDK contacts the PingAM instance. Contains |
|
The base URL of the server to connect to, including port and deployment path. Identity Cloud example:
Self-hosted example:
|
|
A URL to the server’s Use the Example:
Self-hosted example:
|
|
A timeout, in milliseconds, for each request that communicates with your server. For example, for 30 seconds specify Defaults to |
|
The realm in which the OAuth 2.0 client profile and authentication journeys are configured. For example, Defaults to the self-hosted top-level realm |
|
The name of the user authentication tree configured in your server. For example, |
OAuth 2.0
| Property | Description | ||
|---|---|---|---|
|
The |
||
|
The
For example, |
||
|
A list of scopes to request when performing an OAuth 2.0 authorization flow, separated by spaces. For example, |
||
|
A threshold, in seconds, to refresh an OAuth 2.0 token before the Defaults to |
Storage
| Property | Description |
|---|---|
|
The API to use for storing tokens on the client:
|
|
Override the default For example, the key used for storing tokens consists of the
|
Logging
| Property | Description |
|---|---|
|
Specify whether the SDK should output its log messages in the console and the level of messages to display. One of:
|
|
Specify a function to override the default logging behavior. |
General
| Property | Description |
|---|---|
|
Specify whether to include an The server can use the value of this header to alter the logic of an authentication flow. For example, if the value indicates a JavaScript web app, the journey could avoid device binding nodes, as they are only supported by Android and iOS apps. Defaults to |
Endpoints
| Property | Description |
|---|---|
|
Override the path to the authorization server’s Default: |
|
Override the path to the authorization server’s Default: |
|
Override the path to the authorization server’s Default: |
|
Override the path to the authorization server’s Default: |
|
Override the path to the authorization server’s Default: |
|
Override the path to the authorization server’s Default: |
|
Override the path to the authorization server’s Default: |
Examples
The following examples show how to configure the Ping SDK in your JavaScript applications:
Config.setAsync({
serverConfig: {
wellknown: 'https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/root/realms/alpha/.well-known/openid-configuration',
timeout: 3000,
paths: {
authenticate: 'iam/endpoints/authN',
authorize: 'iam/endpoints/authZ'
},
},
clientId: 'sdkPublicClient',
scope: 'openid profile email address',
redirectUri: `${window.location.origin}/callback.html`,
realmPath: 'alpha'
});
Using the .well-known endpoint
You can configure the SDKs to obtain many required settings from your authorization server’s .well-known OpenID Connect endpoint.
How do I find my PingOne Advanced Identity Cloud .well-known URL?
You can view the .well-known endpoint for an OAuth 2.0 client in the PingOne Advanced Identity Cloud admin console:
-
Log in to your PingOne Advanced Identity Cloud administration console.
-
Click Applications, and then select the OAuth 2.0 client you created earlier. For example, sdkPublicClient.
-
On the Sign On tab, in the Client Credentials section, copy the Discovery URI value.
For example,
https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/alpha/.well-known/openid-configuration
|
If you are using a custom domain, your
Learn more in Access OIDC configuration discovery endpoint. |
How do I find my PingAM .well-known URL?
To form the .well-known URL for an PingAM server, concatenate the following information into a single URL:
-
The base URL of the PingAM component of your deployment, including the port number and deployment path.
For example,
https://openam.example.com:8443/openam -
The string
/oauth2 -
The hierarchy of the realm that contains the OAuth 2.0 client.
You must specify the entire hierarchy of the realm, starting at the Top Level Realm. Prefix each realm in the hierarchy with the
realms/keyword.For example,
/realms/root/realms/customersIf you omit the realm hierarchy, the top level
ROOTrealm is used by default. -
The string
/.well-known/openid-configuration
Settings gathered from the endpoint include the paths to use for OAuth 2.0 authorization requests, and login endpoints.
Use the Config.setAsync method to use the .well-known endpoint to configure OAuth 2.0 paths:
await Config.setAsync({
serverConfig: {
wellknown: 'https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/root/realms/alpha/.well-known/openid-configuration'
},
clientId: 'sdkPublicClient',
scope: 'openid profile email address',
redirectUri: `${window.location.origin}/callback.html`
});