Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auth0-js

Package Overview
Dependencies
Maintainers
2
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auth0-js

Auth0 headless browser sdk

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
67K
decreased by-61.06%
Maintainers
2
Weekly downloads
 
Created

What is auth0-js?

The auth0-js package is a JavaScript client library for integrating Auth0 authentication and authorization services into web applications. It provides a variety of methods for handling user authentication, managing user sessions, and interacting with Auth0's API.

What are auth0-js's main functionalities?

User Authentication

This feature allows you to authenticate users by redirecting them to the Auth0 login page. The code sample demonstrates how to initialize the Auth0 client and trigger the authentication process.

const auth0 = new auth0.WebAuth({
  domain: 'YOUR_AUTH0_DOMAIN',
  clientID: 'YOUR_CLIENT_ID'
});

auth0.authorize({
  redirectUri: 'YOUR_CALLBACK_URL',
  responseType: 'token id_token',
  scope: 'openid profile email'
});

Handling Authentication Callback

This feature handles the authentication callback after the user has logged in. The code sample shows how to parse the URL hash to extract authentication tokens.

auth0.parseHash((err, authResult) => {
  if (authResult && authResult.accessToken && authResult.idToken) {
    window.location.hash = '';
    // Save the tokens in local storage or a cookie
  } else if (err) {
    console.error('Error parsing hash:', err);
  }
});

User Logout

This feature allows you to log out users from the application. The code sample demonstrates how to trigger the logout process and redirect the user to a specified URL.

auth0.logout({
  returnTo: 'YOUR_RETURN_URL',
  clientID: 'YOUR_CLIENT_ID'
});

Silent Authentication

This feature allows you to silently authenticate users without redirecting them to the login page. The code sample shows how to check the user's session and obtain new tokens if needed.

auth0.checkSession({}, (err, authResult) => {
  if (err) {
    console.error('Error during silent authentication:', err);
  } else {
    // Use the authResult to get new tokens
  }
});

Other packages similar to auth0-js

Keywords

FAQs

Package last updated on 13 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc