2.1.3 • Published 3 years ago

@salte-io/salte-auth-angularjs v2.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

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.

2.1.3

3 years ago

2.1.2

5 years ago

2.1.1

6 years ago

2.1.0

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago