Labsco
auth0 logo

auth0-spa-js

37

by auth0 · part of auth0/agent-skills

Use when adding authentication to Vanilla JS, Svelte, or any framework-agnostic single-page applications - integrates @auth0/auth0-spa-js SDK for SPAs without…

🔥🔥🔥🔥✓ VerifiedFreeAdvanced setup
🧩 One of 7 skills in the auth0/agent-skills package — works on its own, and pairs well with its siblings.

Use when adding authentication to Vanilla JS, Svelte, or any framework-agnostic single-page applications - integrates @auth0/auth0-spa-js SDK for SPAs without…

Inspect the full instructions your agent will receiveExpand

This is the exact playbook injected into your agent when the skill activates — shown here so you can audit it before installing. You don't need to read it to use the skill.

by auth0

Use when adding authentication to Vanilla JS, Svelte, or any framework-agnostic single-page applications - integrates @auth0/auth0-spa-js SDK for SPAs without… npx skills add https://github.com/auth0/agent-skills --skill auth0-spa-js Download ZIPGitHub37

Auth0 SPA JS Integration

Add authentication to any browser-based single-page application using @auth0/auth0-spa-js — the low-level Auth0 SDK for Vanilla JS, Svelte, SolidJS, and any SPA not using React, Angular, or Vue.

Agent instruction: Before providing SDK setup instructions, fetch the latest release version by running:

Copy & paste — that's it
gh api repos/auth0/auth0-spa-js/releases/latest --jq '.tag_name'

Use the returned version in all dependency lines instead of any hardcoded version below. If the command fails, fall back to checking https://github.com/auth0/auth0-spa-js/releases.

When NOT to Use

Detailed Documentation

  • Setup Guide — Automated setup scripts (Bash/PowerShell), Auth0 CLI commands, .env configuration, callback URL setup

  • Integration Patterns — Token management, calling APIs, refresh tokens, organizations, MFA, DPoP, error handling, advanced patterns

  • Testing & Reference — Configuration options, claims reference, testing checklist, common issues, security considerations

Related Skills

Quick Reference

Core Methods

Method Description createAuth0Client(options) Create and initialize client (calls checkSession internally) new Auth0Client(options) Instantiate without auto session check auth0.loginWithRedirect(options?) Redirect to Auth0 Universal Login auth0.loginWithPopup(options?) Open Auth0 login in a popup auth0.logout(options?) Clear session and redirect auth0.handleRedirectCallback(url?) Process redirect result after login auth0.isAuthenticated() Promise<boolean> auth0.getUser() Promise<User | undefined> auth0.getTokenSilently(options?) Promise<string> — access token auth0.checkSession() Attempt silent re-authentication

Common Use Cases

References