An open API service indexing awesome lists of open source software.

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.

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
```