How to initialize authgear on page refresh #5598
-
|
I have a angular SSR project. I am able to integrate with authgear, it redirects to login page and fetches the accessToken. Verified that the tokens are stored in localstorage. However whenever I refresh the page it goes through the whole login flow. My aim is to not redirect to login page as long as the token is valid. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Can you try to change the code on So something like this: See if it works? |
Beta Was this translation helpful? Give feedback.
-
|
Since I was using |
Beta Was this translation helpful? Give feedback.
Since I was using
authguardwhich kicks in before theauthgearis configured it was leading to redirect. I have moved the configure logic to[provideAppInitializer](https://angular.dev/api/core/provideAppInitializer)which makes sure that the authgear is initialized before any code is executed.