Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'
})
}
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();
}
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',
});
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: () => {
const webAuth = (clientID, domain) => {
return new auth0.WebAuth({
clientID,
domain
});
};
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),
});
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() {
public getWebAuth() {
this.log.verbose('Auth', 'getWebAuth()')
return new WebAuth({
clientID: AUTH0_SETTINGS.CLIENT_ID,
domain: AUTH0_SETTINGS.DOMAIN,
})
}
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',
});