Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);