You can tell if you use the new Auth0 SPA JS by looking at your package.json. If it has a dependency on
@auth0/auth0-spa-js
then it’s the new SDK. If it just says auth0-js
then it’s the old one.
Did you look at the Angular Quickstart example (you can download a ready to go project as .zip and just run it via npm install
and npm start
. This is behaving exactly as you want and you can use it as reference.
I just double checked: in the new SDK you actually don’t need to invoke getTokenSilently()
manually because it’s done automatically when the auth0Client is created (which is an improvement over the old SDK where you had to invoke checkSession
manually yourself.
Meanwhile, could you provide the whole authService.js
of yours (and check your package.json
whether it’s using the new or old SDK, as described above, because the latter is really important to give you a proper answer).
In case of using the new SDK, this blog post might also be an additional helpful explanation: