How to use the auth0-js.WebAuth 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 netlify-labs / movie-app / src / utils / authInstance.js View on Github external
export default function WebAuth() {
  // set xsrf token
  const token = initializeXsrfToken() // eslint-disable-line

  return new auth0.WebAuth({
    domain: config.auth0.domain,
    clientID: config.auth0.clientId,
    audience: `universe-theater`,
    responseType: 'token id_token',
    scope: 'openid email profile'
  })
}
github rrecuero / fstack-ethdapp-template / client / src / auth / Auth.js View on Github external
constructor(history) {
    console.log('PROCESS.ENV', process.env);
    this.auth0 = new auth0.WebAuth({
      domain: process.env.REACT_APP_AUTH0_DOMAIN,
      clientID: process.env.REACT_APP_AUTH0_CLIENTID,
      audience: process.env.REACT_APP_AUTH0_AUDIENCE,
      redirectUri: REDIRECT_URI,
      responseType: 'token id_token',
      scope: this.requestedScopes
    });
    this.history = history;
    this.login = this.login.bind(this);
    this.logout = this.logout.bind(this);
    this.getProfile = this.getProfile.bind(this);
    this.handleAuthentication = this.handleAuthentication.bind(this);
    this.isAuthenticated = this.isAuthenticated.bind(this);
    this.scheduleRenewal();
 }
github auth0-blog / vuejs2-authentication-tutorial / utils / auth.js View on Github external
import decode from 'jwt-decode';
import axios from 'axios';
import Router from 'vue-router';
import auth0 from 'auth0-js';
const ID_TOKEN_KEY = 'id_token';
const ACCESS_TOKEN_KEY = 'access_token';

const CLIENT_ID = '{AUTH0_CLIENT_ID}';
const CLIENT_DOMAIN = '{AUTH0_DOMAIN}';
const REDIRECT = 'YOUR_CALLBACK_URL';
const SCOPE = '{SCOPE}';
const AUDIENCE = 'AUDIENCE_ATTRIBUTE';


var auth = new auth0.WebAuth({
  clientID: CLIENT_ID,
  domain: CLIENT_DOMAIN
});

export function login() {
  auth.authorize({
    responseType: 'token id_token',
    redirectUri: REDIRECT,
    audience: AUDIENCE,
    scope: SCOPE
  });
}

var router = new Router({
   mode: 'history',
});
github Edgeryders-Participio / realities / ui / src / services / auth / auth.js View on Github external
import Auth0 from 'auth0-js';
import store from 'store';
import history from '@/services/history';

const auth0 = new Auth0.WebAuth({
  domain: process.env.REACT_APP_AUTH0_DOMAIN,
  clientID: process.env.REACT_APP_AUTH0_CLIENT_ID,
  audience: process.env.REACT_APP_AUTH0_AUDIENCE,
  redirectUri: process.env.REACT_APP_AUTH0_CALLBACK_URL,
  responseType: 'token id_token',
  scope: 'openid email',
});

let handlers = [];

function fireHandlers() {
  handlers.forEach(fn => fn());
}

export default {
  login: () => {
github pizzaql / pizzaql / frontend / public / auth / auth0.js View on Github external
const webAuth = (clientID, domain) => {
	return new auth0.WebAuth({
		clientID,
		domain
	});
};
github NDLANO / learningpath-frontend / src / session / sessionActions.js View on Github external
import auth0 from 'auth0-js';
import { routerActions } from 'react-router-redux';
import {
  locationOrigin,
  ndlaPersonalClientId,
  auth0Domain,
} from '../sources/apiConstants';
import { getTokenExpireAt } from '../util/jwtHelper';
import {
  savePersonalToken,
  removePersonalToken,
} from '../sources/localStorage';

export const setAuthenticated = createAction('SET_AUTHENTICATED');

const auth = new auth0.WebAuth({
  clientID: ndlaPersonalClientId || '',
  domain: auth0Domain || '',
  responseType: 'token',
  redirectUri: `${locationOrigin}/login/success`,
  audience: 'ndla_system',
});

export function parseHash(hash) {
  return dispatch => {
    auth.parseHash({ hash, _idTokenVerification: false }, (err, authResult) => {
      if (authResult && authResult.accessToken) {
        savePersonalToken({
          token: authResult.accessToken,
          expires: getTokenExpireAt(authResult.accessToken),
        });
github dlbnco / tripby.org / app / components / Auth0 / index.js View on Github external
constructor() {
    super()
    const auth = new auth0.WebAuth({
      domain: 'tripby.auth0.com',
      clientID: 'dxItVoNZ8RL7g_SC26qXKLJzlgywHPYp',
      redirectUri: process.env.NODE_ENV === 'production' ? `http://${process.env.DOMAIN}/authorize` : 'http://localhost:3000/authorize',
      responseType: 'token id_token',
      scope: 'openid profile email',
    })
    this.auth = auth
    this.login = this.login.bind(this)
    this.parseHash = this.parseHash.bind(this)
  }
  componentDidMount() {
github Chatie / app / src / providers / auth.ts View on Github external
public getWebAuth() {
    this.log.verbose('Auth', 'getWebAuth()')

    return new WebAuth({
      clientID: AUTH0_SETTINGS.CLIENT_ID,
      domain:   AUTH0_SETTINGS.DOMAIN,
    })
  }
github supermodel / supermodel / packages / cli / src / lib / auth0 / webAuthClient.js View on Github external
const Auth0 = require('auth0-js');

module.exports = new Auth0.WebAuth({
  domain: process.env['AUTH0_DOMAIN'],
  clientID: process.env['AUTH0_CLIENT_ID'],
  responseType: 'id_token token',
  scope: 'openid',
});

auth0-js

Auth0 headless browser sdk

MIT
Latest version published 16 hours ago

Package Health Score

86 / 100
Full package analysis