samples-js-angular icon indicating copy to clipboard operation
samples-js-angular copied to clipboard

Uncaught (in promise): AuthSdkError: Unable to parse a token from the url

Open laharshah opened this issue 6 years ago • 3 comments

When accessing the page 'implicit/callback' directly from the url, getting the below mentioned Error in console.

I think this error should be handdled. Is there a way that we can override or implement different OktaCallbackComponent and hanndle this kind of errors!

ERROR Error: Uncaught (in promise): OAuthError: User is not assigned to the client application. Error at eval (OAuthError.js:20) at Object.../../../../@okta/okta-auth-js/lib/errors/OAuthError.js (vendor.bundle.js:134) at webpack_require (inline.bundle.js:55) at eval (token.js:8) at Object.../../../../@okta/okta-auth-js/lib/token.js (vendor.bundle.js:183) at webpack_require (inline.bundle.js:55) at eval (clientBuilder.js:23) at Object.../../../../@okta/okta-auth-js/lib/clientBuilder.js (vendor.bundle.js:85) at webpack_require (inline.bundle.js:55) at eval (index.js:2) at eval (OAuthError.js:20) at Object.../../../../@okta/okta-auth-js/lib/errors/OAuthError.js (vendor.bundle.js:134) at webpack_require (inline.bundle.js:55) at eval (token.js:8) at Object.../../../../@okta/okta-auth-js/lib/token.js (vendor.bundle.js:183) at webpack_require (inline.bundle.js:55) at eval (clientBuilder.js:23) at Object.../../../../@okta/okta-auth-js/lib/clientBuilder.js (vendor.bundle.js:85) at webpack_require (inline.bundle.js:55) at eval (index.js:2) at resolvePromise (zone.js:809) at eval (zone.js:728) at rejected (okta.service.js:24) at ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:4749) at ZoneDelegate.invoke (zone.js:387) at Zone.run (zone.js:138) at eval (zone.js:858) at ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4740)

laharshah avatar Sep 07 '18 14:09 laharshah

Hello laharshah,

I faced the exact issue which you got. Am using Angular 6 in my project. I got this while logging to my application.

How I resolved this is: I was calling "okta.handleAuthentication();" method in normal logins. This is why I faced that issue. If you are logging in with your API(expressJs), do not call the Okta functions/methods. Where as if you are logging with Okta SSO, call them usually. You will not face the issue.

vishnualeti avatar Mar 08 '19 11:03 vishnualeti

internal ref: OKTA-269846

aarongranick-okta avatar Jun 12 '20 20:06 aarongranick-okta

@laharshah @vishnualeti Thanks for reporting this issue. We hope that you have been able to workaround this issue.

The handleAuthentication() method can throw an exception, which you can handle in your application. The recommended way to do this is to copy the code for the CallbackComponent included with the SDK and add it to your app as your own CallbackComponent. Then you can customize the logic, including catching this exception.

See here for more info: https://github.com/okta/okta-oidc-js/tree/master/packages/okta-angular#oktacallbackcomponent

aarongranick-okta avatar Jun 12 '20 20:06 aarongranick-okta