How To
ForgeRock Identity Platform
ForgeRock Identity Cloud

How do I troubleshoot the ForgeRock SDK for JavaScript?

Last updated Jan 11, 2023

This article contains information on how to diagnose issues within the JavaScript® application, or with communication to the ForgeRock Identity Platform.

1 reader recommends this article


How do I troubleshoot possible CORS issues in AM?

See How do I troubleshoot issues with CORS in AM (All versions)? on troubleshooting CORS issues in AM.

Why is nothing rendering when viewing a page that uses the ForgeRock SDK for JavaScript?

Check the following if the page is blank or the login fields do not display when using the JavaScript SDK:

  1. Confirm that there are no errors in the browser console.
  2. Confirm that calls to the /authenticate endpoint from your app are returning either 200 or 401.

Why can I get a session token, but not an access token?

Check the following if your app is able to obtain a session (SSO) token, but is unable to exchange it for an access token:

Confirm that calls to the /authenticate endpoint from your app are returning 302 and that the location header contains a URL that includes a code query parameter.

  • If 400 is returned, check the HTML response body for a script block defining a pageData variable that describes the error.
  • If 200 is returned, check the following:
    • Ensure that the "Implied consent" property is enabled in the OAuth 2.0 client profile in AM. Without the property, AM returns a page to ask the user to provide consent for the requested scopes, which the SDK is not expecting.
    • If using Chrome 80 or newer, the SameSite=Lax option is possibly being applied, and the session cookie is not being written even though authentication is successful. Without the cookie, AM keeps redirecting to the login page.

Why do I get an error similar to "a mutation operation was attempted on a database that did not allow mutations"?

If you are using Firefox, this error message can occur if you are using the Private Window mode, which prevents the "IndexedDB" functionality the SDK requires from operating correctly.

For more information, see IndexedDB does not function in private browsing mode.

How do I enable Firefox and Safari to collect location data on Mac OS?

Users of your JavaScript SDK application may need to allow the Firefox and Safari browsers to gather location data in Mac OS, if your application uses the device profiling features. Note that Google Chrome and Microsoft Edge are not affected.

To allow Firefox and Safari to collect location data on Mac OS:

  1. In Mac OS, open System Preferences, and then click Security & Privacy.
  2. On the Privacy tab, select Location Services.
  3. If required, click the lock icon to allow changes to the settings to be made, and enter your password.
  4. Select Enable Location Services, and enable the browsers you want to use with your JavaScript SDK application.
  5. If required, click the lock icon again to prevent further changes to the settings.

Why do I get an error similar to "Cannot read property 'digest' of undefined"?

If you are using a Chromium-based browser (including Google Chrome, Microsoft Edge, Opera and Amazon Silk), this error message can occur if you are not accessing the SDK application by using a "secure origin", for example you are using HTTP rather than HTTPS.

For testing purposes, you can use localhost, which Chromium-based browsers consider to be a secure origin. Be sure to configure your CORS filters accordingly.

For more information, see WebCrypto.

Copyright and Trademarks Copyright © 2023 ForgeRock, all rights reserved.