Neurotic Pantaloon Maker

    @salte-io/salte-auth-angularjs

    2.1.3 • Public • Published

    Salte Auth Angular

    NPM Version NPM Downloads CI Build Coveralls

    semantic-release

    An Angular 1.x extension to salte-auth that automatically registers any secured routes for ng-route and ui-router.

    Install

    You can install this package either with npm or with bower.

    npm

    $ npm install @salte-io/salte-auth-angularjs

    Then add a <script> to your index.html:

    <script src="/node_modules/@salte-io/salte-auth-angularjs/dist/salte-auth-angularjs.js"></script>

    Or require('@salte-io/salte-auth-angularjs') from your code.

    bower

    $ bower install salte-io/salte-auth-angularjs

    Then add a <script> to your index.html:

    <script src="/bower_components/salte-auth-angularjs/dist/salte-auth-angularjs.js"></script>

    Usage

    Setting up OAuth in Angular is as simple as providing a config!

    See the documentation for salte-auth for a full list of the configuration options.

    import SalteAuthAngular from '@salte-io/salte-auth-angularjs';
    
    const module = angular.module('Example', [
      SalteAuthAngular
    ]);
    
    module.config((SalteAuthServiceProvider) => {
      // It's possible to secure individual routes with the following libraries:
      // NG Route
      // $routeProvider.when('/', {
      //   template: 'Home',
      //   secured: true
      // });
      // UI Router
      // $stateProvider.state('home', {
      //   url: '/',
      //   secured: true
      // });
    
      SalteAuthServiceProvider.setup({
        providerUrl: 'https://salte-alpha.auth0.com',
        responseType: 'id_token',
        redirectUrl: location.origin,
        clientId: 'mM6h2LHJikwdbkvdoiyE8kHhL7gcV8Wb',
        scope: 'openid',
    
        endpoints: [
            'https://jsonplaceholder.typicode.com/posts/1'
        ],
    
        provider: 'auth0'
      });
    }]);
    
    module.run((SalteAuthService) => {
      SalteAuthService.signInWithIframe().then(() => {
        console.log('we did it!');
      });
    });

    Documentation

    SalteAuthService has all the same public properties and methods as salte-auth.

    Install

    npm i @salte-io/salte-auth-angularjs

    DownloadsWeekly Downloads

    1

    Version

    2.1.3

    License

    MIT

    Unpacked Size

    59.2 kB

    Total Files

    9

    Last publish

    Collaborators

    • cecilia-sanare
    • salte-bot
    • davewoodward