https://github.com/sabyasachibiswal/angular5-social-login
Original project : sabyasachibiswalSocial login api for Angular 6. Includes Facebook and Google login.
AOT Compatible.
Getting started
Install via npm
npm install --save angular-6-social-login
Import the module
In app.module.ts
,
... ; // Configs { let config = id: FacebookLoginProviderPROVIDER_ID provider: "Your-Facebook-app-id" id: GoogleLoginProviderPROVIDER_ID provider: "Your-Google-Client-Id" id: LinkedinLoginProviderPROVIDER_ID provider: "1098828800522-m2ig6bieilc3tpqvmlcpdvrpvn86q4ks.apps.googleusercontent.com" ; ; return config;} @
Usage :
In signin.component.ts
,
;; @ implements OnInit {} public { let socialPlatformProvider; ifsocialPlatform == "facebook" socialPlatformProvider = FacebookLoginProviderPROVIDER_ID; else ifsocialPlatform == "google" socialPlatformProvider = GoogleLoginProviderPROVIDER_ID; else if socialPlatform == "linkedin" socialPlatformProvider = LinkedinLoginProviderPROVIDER_ID; thissocialAuthService; }
In signin.component.html
,
Sign in Sign in with FacebookSign in with Google
Facebook App Id :
You need to create your own app by going to Facebook Developers page.
Add Facebook login
under products and configure Valid OAuth redirect URIs
.
Google Client Id :
Follow this official documentation on how to Create a Google API Console project and client ID.