Breaking changes
This page summarizes breaking changes to the Advanced Identity Cloud/PingAM Login Widget, and how to migrate an existing integration past each one.
Advanced Identity Cloud/PingAM Login Widget 2.x
Advanced Identity Cloud/PingAM Login Widget 2.x introduces breaking changes to configuration, module dependencies, and the public API. This section summarizes what changed, why it changed, and how to migrate an existing 1.x integration.
Summary of changes
-
Configuration is now driven by a single async
configure()function; the synchronousconfiguration()+.set()pattern is removed. -
Endpoint discovery is now driven by the
serverConfig.wellknownproperty, that is shared by the Journey and OIDC clients. -
The nested
forgerockconfig object is replaced by a flat, top-level shape with anoidcClientsub-object. -
The
requestexport, an alias to the legacyHttpClient.request, is removed. -
Underlying dependencies have moved: OAuth/OIDC is now backed by
@forgerock/oidc-client, PingOne Protect is backed by@forgerock/protect, and@forgerock/javascript-sdkis no longer a dependency of the widget.
Migration checklist
-
Rename the
configurationimport toconfigure. -
Replace calls to
configuration()and.set()with a singleawait configure({...}). -
Ensure your endpoint discovery URL property
wellknownis inside theserverConfigproperty.-
Remove any other properties from
serverConfig, such asbaseUrl,timeout,realmPath,tree, and anypathsoverrides.
-
-
Wrap
clientId,redirectUri, andscopein a newoidcClientsub-object.-
Add the
oidcClientsub-object if you use OAuth/OIDC tokens, user info, or logout.
-
-
Remove any calls to the
requestexport. Fetch tokens fromuser.tokens().get()and callfetchyourself. -
Remove
platformHeader, which has no replacement. -
awaitthe returned promise before calling any other Widget API.journey().start(),user.info().get(), anduser.tokens().get()all fail if called beforeconfigure()resolves.
Before and after
Configuration
import Widget, { configuration } from '@forgerock/login-widget';
const myConfig = configuration();
myConfig.set({
forgerock: {
serverConfig: {
baseUrl: 'https://openam-forgerock-sdks.forgeblocks.com/am/',
timeout: 3000,
},
clientId: 'sdkPublicClient',
realmPath: 'alpha',
redirectUri: window.location.href,
scope: 'openid profile email address',
},
});
import '@forgerock/login-widget/widget.css';
import Widget, { configure } from '@forgerock/login-widget';
// configure() is async, so await it before any other Widget API
await configure({
serverConfig: {
wellknown: 'https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/root/realms/alpha/.well-known/openid-configuration',
},
oidcClient: {
clientId: 'sdkPublicClient',
redirectUri: `${window.location.origin}/callback`,
scope: 'openid profile email address',
},
});
Starting a journey after configuration
import Widget, { configuration, journey } from '@forgerock/login-widget';
const myConfig = configuration();
myConfig.set({ forgerock: { /* ... */ } });
new Widget({ target: document.getElementById('widget-root') });
const journeyEvents = journey();
journeyEvents.start();
import Widget, { configure, journey } from '@forgerock/login-widget';
await configure({
serverConfig: {
wellknown: 'https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/root/realms/alpha/.well-known/openid-configuration',
},
oidcClient: { /* ... */ },
});
new Widget({ target: document.getElementById('widget-root') });
journey().start();
Calling a protected resource
import { request } from '@forgerock/login-widget';
const response = await request({
init: { method: 'GET' },
url: 'https://protected.resource.com',
});
import { user } from '@forgerock/login-widget';
const { response: tokens } = await user.tokens().get();
const response = await fetch('https://protected.resource.com', {
method: 'GET',
headers: {
Authorization: `Bearer ${tokens.accessToken}`,
},
});
|
The legacy Neither behavior is provided by the Advanced Identity Cloud/PingAM Login Widget 2.x or If your app depends on these, you must implement them at the consumer level. |
Custom endpoint paths
The following properties are all removed in 2.x. Every endpoint is now discovered from serverConfig.wellknown.
-
serverConfig.paths.authenticate -
serverConfig.paths.authorize -
serverConfig.paths.accessToken -
serverConfig.paths.revoke -
serverConfig.paths.userInfo -
serverConfig.paths.sessions -
serverConfig.paths.endSession
If your deployment does not expose a standard .well-known/openid-configuration document, you must add one before upgrading to 2.x.
Important changes
The following table highlights some important differences between 1.x and 2.x.
| Property | Notes |
|---|---|
|
Use |
|
All seven per-endpoint overrides are gone. |
|
The realm is encoded in the The |
|
Changed in 2.x to be the top-level |
|
Changed in 2.x to be the top-level |
|
Not currently configurable in the widget. |
|
Initialize PingOne Signals separately via |
Related pages
- Tutorial
-
Updated for 2.x.
- API reference
-
Updated for 2.x.