@rss/auth-angular

0.0.3 • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @rss/auth-angular

Weekly Downloads

1

Version

0.0.3

License

none

Last publish

Collaborators

  • rss