How to use the auth0-js.Authentication 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 patrickmichalina / fusing-angular-v1-archived / src / server / services / user.service.ts View on Github external
import { Inject, Service } from 'typedi'
import { Authentication, Management } from 'auth0-js'
import {
  AUTH0_CERT,
  AUTH0_MANAGEMENT_CLIENT_CONFIG,
  Auth0Cert,
  Auth0Config
} from '../rest-api'
import { Observable, Observer, of } from 'rxjs'
import { flatMap, map } from 'rxjs/operators'
import { verify } from 'jsonwebtoken'

@Service()
export class UserService {
  private readonly client = new Authentication(this.config)
  // tslint:disable-next-line:readonly-keyword
  private token: string

  constructor(
    @Inject(type => AUTH0_MANAGEMENT_CLIENT_CONFIG)
    private config: Auth0Config,
    @Inject(type => AUTH0_CERT)
    private cert: Auth0Cert
  ) {}

  fetchAccessToken(auth0: Authentication): Observable {
    return Observable.create((obs: Observer) => {
      auth0.oauthToken(
        {
          grantType: 'client_credentials',
          audience: `https://${process.env.AUTH0_DOMAIN}/api/v2/`,
github auth0 / auth0-cordova / example / app / src / App.js View on Github external
function App() {
    this.webAuth = new Auth0.WebAuth({
        domain: env.domain,
        clientID: env.clientID
    });
    this.auth0 = new Auth0.Authentication(this.webAuth, {
        domain: env.domain,
        clientID: env.clientID
    });
    this.login = this.login.bind(this);
    this.logout = this.logout.bind(this);
}
github auth0 / auth0-cordova / example / cordova / src / App.js View on Github external
function App() {
    this.auth0 = new Auth0.Authentication({
        domain: env.domain,
        clientID: env.clientID
    });
    this.login = this.login.bind(this);
    this.logout = this.logout.bind(this);
}
github supermodel / supermodel / packages / cli / src / commands / signin.js View on Github external
const auth0 = require('auth0-js')

const auth = new auth0.Authentication({
  domain:       'goodapi.auth0.com',
  clientID:     'TCJ1lTepFTDAfxe1QjPB70vgVKqqwpCl'
});

/**
 * Runs login command. Authenticate user against Auth0 and store necessary data ... TODO: which one?
 *
 * @param {string} username
 * @param {string} password
 */
function login(username, password) {
  auth.login({
    realm: 'Username-Password-Authentication',
    username,
    password,
  }, function(error, response) {
github darkyen / pkce-demos / src / App.js View on Github external
constructor() {
        this.auth0 = new Auth0.Authentication({
            domain: env.domain,
            clientID: env.clientID
        });
        this.state = {
            authenticated: false,
            accessToken: false,
            currentRoute: '/',
            routes: {
                '/': {
                    id: 'loading',
                    onMount: (page) => {
                        if (this.state.authenticated)
                            return this.redirectTo('/home');
                        return this.redirectTo('/login');
                    }
                },
github auth0 / auth0-cordova / src / index.js View on Github external
function CordovaAuth(options) {
  this.clientId = options.clientId;
  this.domain = options.domain;
  this.redirectUri = options.packageIdentifier + '://' + options.domain + '/cordova/' + options.packageIdentifier + '/callback';
  this.auth0 = new auth0.WebAuth({
    clientID: this.clientId,
    domain: this.domain
  });
  this.client = new auth0.Authentication(this.auth0, {
    clientID: this.clientId,
    domain: this.domain,
    _telemetryInfo: telemetry
  });
}
github darkyen / pkce-demos / src / PKCEAuth.js View on Github external
constructor(domain, clientID, redirectUri) {
        if (!domain) {
            throw new Error('You must provide an auth0 domain as the first parameter');
        }
        if (!clientID) {
            throw new Error('You must provide a clientID');
        }
        if (!redirectUri) {
            throw new Error('You must provide a clientID, which is used for building the AuthorizeURL and Exchange code for token');
        }
        this.keys = generateRandomChallengePair();
        this.redirectUri = redirectUri;
        this.client = new auth0.Authentication({
            domain,
            clientID
        });
    }
github supermodel / supermodel / packages / cli / src / lib / auth0 / authClient.js View on Github external
const Auth0 = require('auth0-js');

module.exports = new Auth0.Authentication({
  domain: process.env['AUTH0_DOMAIN'],
  clientID: process.env['AUTH0_CLIENT_ID'],
});

auth0-js

Auth0 headless browser sdk

MIT
Latest version published 18 days ago

Package Health Score

86 / 100
Full package analysis