Innotec Auth Plugin
The Innotec-Auth-Plugin is designed to handle all authentication processes for applications where's conntected to the innotec v2 infrastructure. Theses plugin provides different authentication processes:
- Authentication over authentication providers (Github, PayPal, Facebook ...)
- Authentication over the Innotec V2 Infrastructure (Authentication by username and password)
With this module its easy to connect the infrastructure.
Installation
NOTE: please use npm 3.*
((sudo) npm i -g npm@3
)
npm i --save --save-exact innotec-auth-plugin
Import in your app module
You can import the module in your Application with:
import { InnotecAuthPlugin } from 'innotec-auth-plugin';
Integration Steps
First
At first you must set your personal options of your app. To set this options call the moduleoptions
Service:
import { ModuleOptions } from 'innotec-auth-plugin';
.
.
export class YoUrClAsSs {
constructor (private options: ModuleOptions) {
}
public yourService() {
let options = {
companylogo: "http://yourLogoURL",
clientid: 'Innotec Client ID',
clientsecret: 'Innotec Client Secret',
facebook_clientid: 'abc',
google_clientid: 'abc',
paypal_clientid: 'abc',
endpoint: 'live',
userregisterurl: 'url',
closeable: true
};
this.options.set(options);
}
}
Second
At next you can import the loginfield in your base template:
<login-field [open]='!isLoggedIn'></login-field>
The loginfield is hidden in default-mode. You can open the loginfield with the open property in this element. If the open property true, the login will displayed as fixed container.
Third
To check the loginstate you can call the auth service:
import { CheckAuthStatus } from 'innotec-auth-plugin';
export class YoUrClAsSs {
constructor (private auth: CheckAuthStatus) {
}
public yourService() {
this.auth.check();
}
}
You can subscribe the variable also:
this.auth.isLoggedIn().subscribe((state) => {
this.isLoggedIn = state
});
Additional functions
CheckAuthStatus:
- logout(): User will logged out - Cookie will deleted.
- getTokenInfo(): Will response all tokeninfo. Ex. userobj.picture is users picture
(C) 2017 - Werbas AG / Werbas Innotec GmbH
All rights reserverd!