@salte-io/salte-auth-angularjs v2.1.3
Salte Auth Angular
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.
3 years ago
5 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago