https://github.com/heresy/angularjs-social-login
Simple social authentication module for AngularJS applications.
https://github.com/heresy/angularjs-social-login
angularjs angularjs-social-login
Last synced: about 1 year ago
JSON representation
Simple social authentication module for AngularJS applications.
- Host: GitHub
- URL: https://github.com/heresy/angularjs-social-login
- Owner: heresy
- Created: 2015-12-09T16:35:35.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-03-13T02:40:36.000Z (over 6 years ago)
- Last Synced: 2025-04-07T03:09:47.304Z (about 1 year ago)
- Topics: angularjs, angularjs-social-login
- Language: JavaScript
- Homepage: https://github.com/heresy/angularjs-social-login
- Size: 24.4 KB
- Stars: 56
- Watchers: 13
- Forks: 59
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AngularJS Social Login (socialLogin)
AngularJS Social Login Module is a simple client side authentication module which helps to authenticate your application using Google/Facebook/LinkedIN. It doesn't maintain any session, session between client application and server should be maintained by yourself after receiving user details from the provider.
Supported sites:
- Google
- Facebook
- LinkedIN
## Installation
### via npm
```shell
npm install angularjs-social-login --save
```
### via bower
```shell
bower install angularjs-social-login --save
```
### configure installation
Include JS files:
```html
```
Then include `socialLogin` as a dependency for your app:
```javascript
angular.module('myApp', ['socialLogin']);
```
## Configuration
### Example
```javascript
app.config(function(socialProvider){
socialProvider.setGoogleKey("YOUR GOOGLE CLIENT ID");
socialProvider.setLinkedInKey("YOUR LINKEDIN CLIENT ID");
socialProvider.setFbKey({appId: "YOUR FACEBOOK APP ID", apiVersion: "API VERSION"});
});
```
## Usage
There are total three directives for handling Google, Facebook, LinkedIn authentication.
- fbLogin (For Facebook)
- gLogin (For Google)
- linkedIn (For LinkedIn)
### Methods
- `socialProvider.setGoogleKey("YOUR GOOGLE CLIENT ID")`
- `socialProvider.setLinkedInKey("YOUR LINKEDIN CLIENT ID")`
- `socialProvider.setFbKey("YOUR FACEBOOK APP ID")`
- `$rootScope.$on('event:social-sign-in-success', function(event, userDetails){})`
Braodcast event which will be triggered after successful authentication. `userDetails` is an `Object` consists of `{name: , email: , imageUrl: , uid: , provider: , token: < accessToken for Facebook & google, no token for linkedIN>}, idToken: < google idToken >`
- `socialLoginService.logout()`
For logout
- `$rootScope.$on('event:social-sign-out-success', function(event, logoutStatus){})`
Braodcast event which will be triggered after successful logout.
### Example
```html
Google Login
LinkedIn Login
facebook Login
```