ngx-smauth
v2.0.1
Published
SmAuth is an angular 12 sm authentication plugin.
Downloads
102
Readme
NgxSmauth
SmAuth is an angular 12 sm authentication plugin.
Installation
Use the node package manager npm to install minmax.
npm i ngx-smauth
Usage
In your app module :
import { NgxSmauthModule, NgxSmauthDirective } from 'ngx-smauth';
....
imports: [
....
NgxSmauthModule
.....
],
providers: [
NgxSmauthDirective
],
....
in your environment file declare the following :
auth_login: 'login_url', (Login URL)
auth_callback_url : 'http://localhost:4200', (return url)
auth_logout: 'logout_url', (logout url)
auth_me: 'me_api_url', (token validate url)
local_key_name: 'token_key_name', (local key name)
app_key: 'BF1E43QRN7_PA6T9M6C1QO', (app key)
home_url: '/', (entry point)
restore_load_url: true, (if should let user be on the initial url loaded)
In your app root component import NgxSmauthDirective and environment:
import { NgxSmauthDirective } from 'ngx-smauth';
import {environment} from '../environments/environment'
initalise NgxSmauthDirective in your constructor as following :
constructor( private smauth: NgxSmauthDirective) {
this.smauth.auth_init(environment);
}