Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

v2.0.0

Compare
Choose a tag to compare
@cecilia-sanare cecilia-sanare released this 15 Oct 16:34

New Features

Manually Execute a Login

exampleModule.controller((SalteAuthService) => {
  SalteAuthService.loginWithIframe().then(() => {
    // We successfully logged in!
  }).catch((error) => {
    // Whoops, looks like something went wrong!
  });

  SalteAuthService.loginWithPopup().then(() => {
    // We successfully logged in!
  }).catch((error) => {
    // Whoops, looks like something went wrong!
  });

  // We don't recommend logging in via redirect 
  // since we can't return a promise.
  SalteAuthService.loginWithRedirect();
});

Manually Execute a Logout

exampleModule.controller((SalteAuthService) => {
  SalteAuthService.logoutWithIframe().then(() => {
    // We successfully logged out!
  }).catch((error) => {
    // Whoops, looks like something went wrong!
  });

  SalteAuthService.logoutWithPopup().then(() => {
    // We successfully logged out!
  }).catch((error) => {
    // Whoops, looks like something went wrong!
  });

  // We don't recommend logging out via redirect 
  // since we can't return a promise.
  SalteAuthService.logoutWithRedirect();
});

Support for UI Router 1.x+

We now support UI Router 1.x+!

BREAKING CHANGES

Setup - init -> setup

Before

exampleModule.config(($httpProvider, salteAuthServiceProvider) => {
  // ...
  salteAuthServiceProvider.init({
    url: 'https://salte-io.auth0.com',
    responseType: 'id_token',
    redirectUrl: location.origin,
    clientId: 'Hzl9Rvu_Ws_s1QKIhI2TXi8NZRn672FC',
    scope: 'openid',

    securedEndpoints: {
      '/api' : 'mySecuredAPI'
    }
  }, $httpProvider);
}

After

exampleModule.config((SalteAuthServiceProvider) => {
  // ...
  SalteAuthServiceProvider.setup({
    providerUrl: 'https://salte-io.auth0.com',
    responseType: 'id_token',
    redirectUrl: location.origin,
    clientId: 'Hzl9Rvu_Ws_s1QKIhI2TXi8NZRn672FC',
    scope: 'openid',

    endpoints: [
      '/api'
    ],

    provider: 'auth0'
  });
}

Securing Routes - requireAuthentication -> secured

Before

exampleModule.config(($stateProvider) => {
  // ...
  $stateProvider.state({
    // ...
    requireAuthentication: true
  });
}

After

exampleModule.config(($stateProvider) => {
  // ...
  $stateProvider.state({
    // ...
    secured: true
  });
}