I'm currently working on a simple NativeScript / Angular
project that is based on the code sample located at:
https://github.com/alexziskind1/nativescript-oauth2/tree/master/demo-angular
This project allows users to log in with their Google
credentials.
Once the user enters their login information, they should be redirected back to the app and taken to the route: /authenticated
.
The issue I am facing lies within the file login.component.ts. When the method
this.routerExtensions.navigate(["/authenticated"])
is called, sometimes it successfully redirects the user to the specified route, but other times it does not. I've tried to analyze the circumstances of when this occurs, but it seems to happen randomly.
On the other hand, I want to mention that I am always able to see the access token logged in the console, indicating that the authService
is functioning correctly. However, the problem seems to be with the navigation aspect.
Additionally, I am uncertain whether I should use:
this.routerExtensions.navigate(["/authenticated"])
or
this.routerExtensions.navigate(["../authenticated"])
In the official code sample, there are two dots (as shown in the second case) as seen here:
However, that doesn't appear to be the root cause of the issue.
I believe I may be overlooking something here.
Below you'll find snippets of my code.
...