samples-js-angular
samples-js-angular copied to clipboard
Uncaught (in promise): AuthSdkError: Unable to parse a token from the url
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)
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.
internal ref: OKTA-269846
@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