ng-social-login-module
This library is an updated version of ng4-social-login.
Social login authentication module for Angular 6 and above versions. Supports authentication with Google, Linkedin and Facebook.
For angular version < 6 check out ng4-social-login.
Getting started
Installation
npm install --save ng-social-login-moduleyarn add ng-social-login-module
Import the module
In your AppModule
, import the SocialLoginModule
; /** * config takes two params * 1. Provider config array * 2. Boolean to auto logged */const CONFIG = id: GoogleLoginProviderPROVIDER_ID provider: 'Google-OAuth-Client-Id' id: FacebookLoginProviderPROVIDER_ID provider: 'Facebook-App-Id' id: LinkedinLoginProviderPROVIDER_ID provider: 'LINKEDIN_CLIENT_ID' true; { return CONFIG;} @
Sign in and out users
; @ implements OnInit { } : void thisauthService; : void thisauthService; : void thisauthService; : void thisauthService;
Subscribe to the authentication state
You are notified when user logs in or logs out. You receive a SocialUser
object when the user logs in and a null
when the user logs out. SocialUser
object contains basic user information such as name, email, photo URL, etc.
;; @ implements OnInit private user: SocialUser; private loggedIn: boolean; { } { thisauthServiceauthState; }
Display the user information
{{ user.name }} {{ user.email }}
Contributing to project
you are welcome to report an issue or creating a pull request.
This project was generated with Angular CLI version 6.1.1.
Development server
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Code scaffolding
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Build
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Running unit tests
Run ng test
to execute the unit tests via Karma.
Running end-to-end tests
Run ng e2e
to execute the end-to-end tests via Protractor.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.