ngx-heyl-social-login
v1.0.2
Published
A easy-to-use service to login with Facebook and / or Google provider
Downloads
1
Maintainers
Readme
ngx-heyl-snackbar
This package allows you to login with Google and/or Facebook api in AngularX (2+)
Installation
Install npm module :
npm install ngx-heyl-social-login
Import the module :
Open your
app.module.ts
file and import the module like this :import { SocialLoginModule } from "ngx-heyl-social-login"; @NgModule({ imports: [ ..., SocialLoginModule ] })
Initialize Google and/or Facebook api in
app.component.ts
:Open your
app.component.ts
and initialize Google and/or Facebook api :constructor(private socialLoginService: SocialLoginService) { // FacebookAppID : 15 digit number this.socialLoginService.initFacebookProvider("FacebookAppID", "v2.9"); // GoogleAppId : numbers-numbersAndLetters this.socialLoginService.initGoogleProvider("GoogleAppId"); }
######! Note : Call these functions will add to your
<head>
HTML element you'll need to have. Don't put by yourself Google and Facebook sdk's, or Google's<meta>
elementNow yo can use the googleLogin and facebookLogin in your other components :
facebookLogin() { this.socialLoginService.facebookLogin(socialUser => { console.log(socialUser); }); } googleLogin() { this.socialLoginService.googleLogin(socialUser => { console.log(socialUser); }); }