How do I get single-sign-on to work with auth0-javascript-samples/02-Calling-an-API?

Hello, welcome to our Community!

Unfortunately, SPAs use Embedded login, in which the session is created in the app itself, and not in Auth0. Because of that, there is no persistent session in Auth0. That means, there is no existing session to look for to perform SSO.

To use SSO, you can use Universal login.

We recommend you this document that has more information about both universal and embedded login: Centralized Universal Login vs. Embedded Login

Thank you!