How to use @auth0/cordova - 3 common examples

To help you get started, we’ve selected a few @auth0/cordova 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 auth0-samples / auth0-ionic3-samples / 01-Login / src / services / auth.service.ts View on Github external
import { Injectable, NgZone } from '@angular/core';
import { Storage } from '@ionic/storage';
import { SafariViewController } from '@ionic-native/safari-view-controller';

// Import AUTH_CONFIG, Auth0Cordova, and auth0.js
import { AUTH_CONFIG } from './auth.config';
import Auth0Cordova from '@auth0/cordova';
import * as auth0 from 'auth0-js';

@Injectable()
export class AuthService {
  Auth0 = new auth0.WebAuth(AUTH_CONFIG);
  Client = new Auth0Cordova(AUTH_CONFIG);
  accessToken: string;
  user: any;
  loggedIn: boolean;
  cordova: any;
  loading = true;

  constructor(
    public zone: NgZone,
    private storage: Storage,
    public safariViewController: SafariViewController
  ) {
    this.storage.get('profile').then(user => this.user = user);
    this.storage.get('access_token').then(token => this.accessToken = token);
    this.storage.get('expires_at').then(exp => {
      this.loggedIn = Date.now() < JSON.parse(exp);
      this.loading = false;
github auth0-samples / auth0-ionic3-samples / 01-Login / src / app / app.component.ts View on Github external
(window as any).handleOpenURL = (url: string) => {
        auth.safariViewController.hide();
        Auth0Cordova.onRedirectUri(url);
      }
    });
github auth0 / auth0-cordova / example / cordova / src / index.js View on Github external
function intentHandler(url) {
        Auth0Cordova.onRedirectUri(url);
    }
    window.handleOpenURL = intentHandler;

@auth0/cordova

Auth0 integration for Cordova applications

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Popular @auth0/cordova functions