Ionic 3

Authenticate Ionic 3 with Evernote using Auth0

  • Authentication as a service
  • Easy to integrate
  • Customizable
  • Secure token auth

Setup your application's code

Add the following lines to your base code

// src/services/auth.service.ts
import { Injectable, NgZone } from '@angular/core';
import { Storage } from '@ionic/storage';

// Import Auth0Cordova and auth0.js
import Auth0Cordova from '@auth0/cordova';
import * as auth0 from 'auth0-js';

const AUTH_CONFIG = {
  // Needed for Auth0 (capitalization: ID):
  clientID: 'YOUR_CLIENT_ID',
  // Needed for Auth0Cordova (capitalization: Id):
  clientId: 'YOUR_CLIENT_ID',
  domain: 'YOUR_DOMAIN',
  callbackURL: location.href,
  packageIdentifier: 'YOUR_PACKAGE_ID' // config.xml widget ID

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

    public zone: NgZone,
    private storage: Storage
  ) {'profile').then(user => this.user = user);'access_token').then(token => this.accessToken = token);'expires_at').then(exp => {
      this.loggedIn = < JSON.parse(exp);
      this.loading = false;

  login() {
    this.loading = true;
    const options = {
      scope: 'openid profile offline_access'
    // Authorize login request with Auth0: open login page and get auth results
    this.Client.authorize(options, (err, authResult) => {
      if (err) {
        throw err;
      // Set Access Token'access_token', authResult.accessToken);
      this.accessToken = authResult.accessToken;
      // Set Access Token expiration
      const expiresAt = JSON.stringify((authResult.expiresIn * 1000) + new Date().getTime());'expires_at', expiresAt);
      // Set logged in
      this.loading = false;
      this.loggedIn = true;
      // Fetch user's profile info
      this.Auth0.client.userInfo(this.accessToken, (err, profile) => {
        if (err) {
          throw err;
        }'profile', profile).then(val =>
 => this.user = profile)

  logout() {'profile');'access_token');'expires_at');
    this.accessToken = null;
    this.user = null;
    this.loggedIn = false;

Create an Application in Auth0 dashboard

Create an Application in Auth0 dashboard

Create a Social Evernote Connection under Connections / Social section

Create a Social Connection for authentication
Get started in minutes
Authentication Security and Availability

Authentication Built for Security & High Availability

Auth0 is the easiest way for developers to integrate enterprise-grade authentication and identity management to any app.

Industry Standard Compliance
Authentication Certifications and Compliance

SOC 2, HIPAA/BAA, EU/US Privacy Shield Framework, Open ID Certified.

Learn More
Built by Security Experts
Authentication Experts

Continuously reviewed and tested by external security experts. Strong password encryption and hashing algorithms, at rest and in transit.

Learn More
What Our Customers Say
Authentication Case Studies

Continuously reviewed and tested by external security experts. Strong password encryption and hashing algorithms, at rest and in transit.

Learn More
Availability & trust
Authentication Availability

Uptime time in 3 different regions.

Learn More
Host Anywhere
Auth0 Appliance

Deploy On-Premises or on Cloud on your data center or Auth0’s one.

Learn More
Auth0 Active Users

Get Auth0 free for 7,000 active users per month with unlimited logins

  • Single Sign On
  • Passwordless Login
  • Up to 2 Social Identity Providers
  • Multifactor Authentication
  • User Management
  • Extensibility (Run custom code on Auth)

Some of the companies that trust us every day

Atlassian - Authentication CustomerPBS - Authentication CustomerNVIDIA - Authentication CustomerMozilla - Authentication CustomerBluetooth - Authentication CustomerFinancial Times - Authentication CustomerJet - Authentication CustomerHMH - Authentication CustomerOptimizely - Authentication CustomerPolaris - Authentication CustomerHarper - Authentication CustomerNews Corp - Authentication Customer