okta / okta-auth-js

The official js wrapper around Okta's auth API
Other
451 stars 265 forks source link

OktaAuth.TokenApi.getWithoutPrompt() does not catch error with incorrect clientIdTokenParams.clientId #1423

Open danielfyo opened 1 year ago

danielfyo commented 1 year ago

Describe the bug

Hello @pawitp @cmatheson @Almad @bdemers @robertjd,

I have a situation trying to retrieve tokens using getWithoutPrompt when the clientId used to set up the OktaAuth is incorrect, token.getWithoutPrompt() is not being resolved nor rejected, it looks like is because of the iframe you use to retrieve the tokens.

For example,

this.authClient = new OktaAuth({ issuer: process.env.REACT_APP_OKTA_TOKEN_ISSUER, clientId: process.env.BAD_OKTA_CLIENT_ID, redirectUri: window.location.origin + "/sign-in/callback", pkce: true, });

this.authClient.token .getWithoutPrompt() .then((res) => console.log('res', res)) .catch((error) => console.log('error', error));

In the code above, the then and catch blocks are never executed.

Reproduction Steps?

  1. Configure OktaAuth with an invalid clientId
  2. Call getWithoutPrompt
  3. Then and catch blocks are never executed

SDK Versions

@okta/okta-auth-js 7.3.0

Additional Information?

it seems like is a known issue https://github.com/okta/okta-auth-js/issues/1018

lesterchoi-okta commented 1 year ago

internal ref OKTA-624378