Gathering detailed insights and metrics for @auth0/auth0-spa-js
Gathering detailed insights and metrics for @auth0/auth0-spa-js
Gathering detailed insights and metrics for @auth0/auth0-spa-js
Gathering detailed insights and metrics for @auth0/auth0-spa-js
@afroze9/solid-auth0
A wrapper on top of auth0-spa-js for solidjs.
@oqton/auth0-spa-js
Auth0 SDK for Single Page Applications using Authorization Code Grant Flow with PKCE
auth0-spa-js
Auth0 SDK for Single Page Applications using Authorization Code Grant Flow with PKCE
@ctx-core/auth0-spa-solid
Auth0 solid-js components & ctx-core integration for progressive web apps
Auth0 authentication for Single Page Applications (SPA) with PKCE
npm install @auth0/auth0-spa-js
Typescript
Module System
Node Version
NPM Version
TypeScript (61.54%)
JavaScript (30.41%)
HTML (8.05%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
959 Stars
774 Commits
386 Forks
32 Watchers
33 Branches
95 Contributors
Updated on Jul 15, 2025
Latest Version
2.2.0
Package Id
@auth0/auth0-spa-js@2.2.0
Unpacked Size
1.23 MB
Size
327.67 kB
File Count
66
NPM Version
10.8.2
Node Version
18.20.8
Published on
May 29, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
45
📚 Documentation - 🚀 Getting Started - 💻 API Reference - 💬 Feedback
Using npm in your project directory run the following command:
1npm install @auth0/auth0-spa-js
From the CDN:
1<script src="https://cdn.auth0.com/js/auth0-spa-js/2.2/auth0-spa-js.production.js"></script>
Create a Single Page Application in the Auth0 Dashboard.
If you're using an existing application, verify that you have configured the following settings in your Single Page Application:
- Click on the "Settings" tab of your application's page.
- Scroll down and click on the "Show Advanced Settings" link.
- Under "Advanced Settings", click on the "OAuth" tab.
- Ensure that "JsonWebToken Signature Algorithm" is set to
RS256
and that "OIDC Conformant" is enabled.
Next, configure the following URLs for your application under the "Application URIs" section of the "Settings" page:
http://localhost:3000
http://localhost:3000
http://localhost:3000
These URLs should reflect the origins that your application is running on. Allowed Callback URLs may also include a path, depending on where you're handling the callback (see below).
Take note of the Client ID and Domain values under the "Basic Information" section. You'll need these values in the next step.
Create an Auth0Client
instance before rendering or initializing your application. You should only have one instance of the client.
1import { createAuth0Client } from '@auth0/auth0-spa-js'; 2 3//with async/await 4const auth0 = await createAuth0Client({ 5 domain: '<AUTH0_DOMAIN>', 6 clientId: '<AUTH0_CLIENT_ID>', 7 authorizationParams: { 8 redirect_uri: '<MY_CALLBACK_URL>' 9 } 10}); 11 12//or, you can just instantiate the client on its own 13import { Auth0Client } from '@auth0/auth0-spa-js'; 14 15const auth0 = new Auth0Client({ 16 domain: '<AUTH0_DOMAIN>', 17 clientId: '<AUTH0_CLIENT_ID>', 18 authorizationParams: { 19 redirect_uri: '<MY_CALLBACK_URL>' 20 } 21}); 22 23//if you do this, you'll need to check the session yourself 24try { 25 await auth0.getTokenSilently(); 26} catch (error) { 27 if (error.error !== 'login_required') { 28 throw error; 29 } 30}
You can then use login using the Auth0Client
instance you created:
1<button id="login">Click to Login</button>
1//redirect to the Universal Login Page 2document.getElementById('login').addEventListener('click', async () => { 3 await auth0.loginWithRedirect(); 4}); 5 6//in your callback route (<MY_CALLBACK_URL>) 7window.addEventListener('load', async () => { 8 const redirectResult = await auth0.handleRedirectCallback(); 9 //logged in. you can get the user profile like this: 10 const user = await auth0.getUser(); 11 console.log(user); 12});
For other comprehensive examples, see the EXAMPLES.md document.
Explore API Methods available in auth0-spa-js.
We appreciate feedback and contribution to this repo! Before you get started, please see the following:
To provide feedback or report a bug, please raise an issue on our issue tracker.
Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout Why Auth0?
This project is licensed under the MIT license. See the LICENSE file for more info.
No vulnerabilities found.
Reason
all changesets reviewed
Reason
10 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
SAST tool detected
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
5 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More