How to use the auth0-js/src/web-auth function in auth0-js

To help you get started, we’ve selected a few auth0-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dramloc / preact-auth0-template / template / src / lib / auth / index.js View on Github external
import { route } from 'preact-router';
import WebAuth from 'auth0-js/src/web-auth';

const auth = new WebAuth({
	domain: process.env.AUTH0_DOMAIN,
	clientID: process.env.AUTH0_CLIENT_ID,
	redirectUri: process.env.REDIRECT_URI,
	audience: `https://${process.env.AUTH0_DOMAIN}/userinfo`,
	responseType: 'token id_token',
	scope: 'openid profile' // only use `openid` if you don't need user profile
});

function login() {
	auth.authorize();
}

function handleAuthentication() {
	auth.parseHash((err, authResult) => {
		if (err) {
			route('/', true);

auth0-js

Auth0 headless browser sdk

MIT
Latest version published 20 days ago

Package Health Score

86 / 100
Full package analysis