No token in local storage for okta redirect in angular and authstate null or undefined

I am using okta-angular 5.x and okta-auth-js 6.0. i created okta_config with clientid, issuer, redirect url, pkce. I have added in provider in app.module okta_config and created an oidc factory which returns new okta_auth and has onAuthRequired which redirects if not authenticated. I have imported oktaauthmodule in app.module. I have oktaauthguard to redirect request to okta and I think it uses the oktaconfig I have provided in app.module. in app component and also in http interceptor I inject (OKTA_AUTH) to get token and isauthenticated state details. The app redirects to okta hosted login page then after credentials are entered it calls the redirect url but the oktaauthstate is null and token is also null. I checked the networks tab it does not have Authorize request call after I click login. In application local storage I can see the transaction. In cache I can see other details like the token, key, Authorization url. But in local storage the okta token is empty{}. The app keeps calling the redirect url again and again, I think it should not since it’s not authenticated and it should not redirect back to the protected route so that it calls redirect again to okta.

Hi there @Naeem !

I’m having a little trouble visualizing this. To ensure I understand, is your redirect route public so the redirect callback succeeds? It might help to include a snippet of your route paths.

Can you also provide your factory method snippet (please feel free to redact any private information)? I think that will help me have a more complete picture.

Let’s see if we can figure this out together. :slight_smile:

@alisaduncan thank you for your reply, i created a new thread after fixing the redirect issue and finding new information. Token url not being called
Please do have a look

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.