Hi, I have deployed angular app on dev instance using issuer as https://dev-14684919.okta.com/ and client id for the application created. But when i call backend api the call goes from the interceptor and the page reloads. This is happening in loop and app is stuck there. The backend api is also using the above issuer and client id for authentication. I have also configured deployed app details in api for cors. The api is able to process the request, but the page reloads as soon as the call is gone from next.handle(request).toPromise(). Kindly request you for help.
Are you seeing this after you authenticate and then navigate to a view that makes an HTTP call? Does the view you’re on reload? Or are you redirected to authenticate again?
Can you share a snippet of your interceptor code? You shouldn’t have to call toPromise()
You may want to try using this sample project to see if you observe the same behavior by modifying your issuer, domain, and anything else you want to incorporate from your application.
It happens after authentication, I get the access token from okta.getAccessToken method and send it to the request as a bearer token. This all is happening after deployment to dev instance. Locally it works totally fine without any issue. The only difference I noticed is locally I am calling from http://localhost:8080 and dev instance is https.
Can you please provide sample project?
I am using angular 11 with @okta/okta-angular 3.1.0 package.
Just to make sure I understand. Are you seeing this looping behavior when you serve locally? Or do you only see this in the deployed application? Do you see any page reloading if you don’t register the interceptor?
Can you share what you see on the network tab in DevTools? Please redact any secrets if you share pics, and you may have to enable “Preserve logs.”
Also, would you mind clarifying what “page reloads” means? Are you saying after you sign in, you navigate to a route that makes a HTTP request, then the app reloads? Can you share anything you see in the Network tab and the DevTools Console?