@rss/auth-angular
v0.0.3
Published
auth module for angular
Downloads
2
Readme
@rss/auth-angular
Helper library for working with token server on angular
Installation
$ npm install @rss/auth-angular
Client Usage (angular)
Initialize
Client.checkIfAuthenticated should be call in the app.component
import { Client } from '@rss/auth/angular-angular';
export class AppComponent {
ngOnInit() {
Client.checkIfAuthenticated(this.location, 'URL_TO_AUTHENTICATE_USER').then(() => {
// user is authenticated - load profile
});
}
}
Client API
Client.checkIfAuthenticated(location, 'URL_TO_AUTHENTICATE_USER')
check if user is authenticate. if not, redirect user to authentication url
Client.getUserToken()
get user token if available
Client.redirectToAuthentication('URL_TO_AUTHENTICATE_USER')
redirect user to token server for authentication