Auth0 Home Blog Docs

Announcing the General Availability of the Auth0 SPA JS SDK

Auth0 has a new JS SDK for securing single page applications (SPAs) with best practices.

Learn more about the JavaScript SDK here.

Post brought to you by @sam.julien :man_technologist:t2:

1 Like

This looks really great, kudos to the team! So, how would you go about getting a token for a different audience with the new SPA SDK? Like, if you need to be able to talk to more than one API?

Is the tutorial for end-to-end testing using Cypress with Auth0 (https://auth0.com/blog/end-to-end-testing-with-cypress-and-auth0) still relevant with this SDK?

Hey there @le.minh.pham.hoang!

Let me reach out to the team responsible for the SDK to ask that!

1 Like

@robertmclaws2k

See the example here:

$('#getTokenPopup').click(async () => {
  const token = await auth0.getTokenWithPopup({
    audience: 'https://myapi/',
    scope: 'read:something
  });
});

Note that Auth0 doesn’t support multiple audiences for one access token though. An access token is only meant for one backend/API.

1 Like

Hey there again @le.minh.pham.hoang!

Unfortunately the tutorials are not yet up to date with the new SDK but we’re working on getting them ready!

FYI for anyone visiting this topic, we have two new FAQs for auth0-spa-js:

1 Like