# ng-dynami-social-login

> This is social login API for Angular 7.0.3 (Facebook, Google and Linkedin)

Latest version **1.0.8** (published 2018-10-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install ng-dynami-social-login
pnpm add ng-dynami-social-login
yarn add ng-dynami-social-login
bun add ng-dynami-social-login
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2018-10-26 |
| First published | 2018-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 382.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Erandika Sandaruwan |
| Maintainers | erandika1986 |
| Keywords | angular, angular7, ng7, angular social login, angular facebook login, angular google login, angular 7 social login, angular7 social login, social authentication, angular social authentication, angular-social-login, angular7-social-login, social-authentication, social-login, google-authentication, angular-google-authentication, facebook-authentication, angular-facebook-authentication, angular module |

## Links

- npm: https://www.npmjs.com/package/ng-dynami-social-login
- Repository: https://github.com/erandika1986/NgDynamiSocialLogin
- Homepage: https://github.com/erandika1986/NgDynamiSocialLogin#readme
- Issues: https://github.com/erandika1986/NgDynamiSocialLogin/issues
- npm.io page: https://npm.io/package/ng-dynami-social-login

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 1.0.8 (latest) — 2018-10-26
- 1.0.7 — 2018-10-26
- 1.0.6 — 2018-10-26
- 0.0.1 — 2018-10-26
- 1.0.4 — 2018-10-26
- 1.0.3 — 2018-10-26
- 1.0.2 — 2018-10-26
- 1.0.1 — 2018-10-26

## README

This is social login API for Angular 7.0.3 (Facebook, Google and Linkedin) 

Big thanks to  https://github.com/sabyasachibiswal/angular5-social-login . Since They do not support angular 7+ I have modified their source code and published it here to help others.

## Getting Started

### Install package via npm installer

```sh
npm install ng-dynami-social-login
```

###Import the module

In `app.module.ts`

```javascript
...

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { DynamiSocialLoginModule, AuthServiceConfig, GoogleLoginProvider } from 'ng-dynami-social-login';


export function getAuthServiceConfigs() {
  let config = new AuthServiceConfig(
      [
         {
          id: FacebookLoginProvider.PROVIDER_ID,
          provider: new FacebookLoginProvider("XXXXXX")
        },
        {
          id: GoogleLoginProvider.PROVIDER_ID,
          provider: new GoogleLoginProvider("XXXxXXXX.apps.googleusercontent.com")
        }
         ,
          {
            id: LinkedinLoginProvider.PROVIDER_ID,
            provider: new LinkedinLoginProvider("XXXXXXXxXX")
          },
      ]
  );
  return config;
}

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    DynamiSocialLoginModule
  ],
  providers: [{
    provide: AuthServiceConfig,
    useFactory: getAuthServiceConfigs
  }],
  bootstrap: [AppComponent]
})
export class AppModule { }

```

In `login.component.html`

```html
<h1>
     Sign in
</h1>

<button (click)="socialSignIn('facebook')">Sign in with Facebook</button>
<button (click)="socialSignIn('google')">Signin in with Google</button>              
```

In `login.componentng g c logo.ts`

```javascript
...

import { Component, OnInit } from '@angular/core';
import { AuthService, FacebookLoginProvider, GoogleLoginProvider, LinkedinLoginProvider } from 'ng-dynami-social-login';


@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {

  constructor(private socialAuthService: AuthService) { }

  ngOnInit() {
  }

  public socialSignIn(socialPlatform : string) {
    let socialPlatformProvider;
    if(socialPlatform == "facebook"){
      socialPlatformProvider = FacebookLoginProvider.PROVIDER_ID;
    }else if(socialPlatform == "google"){
      socialPlatformProvider = GoogleLoginProvider.PROVIDER_ID;
    } else if (socialPlatform == "linkedin") {
      socialPlatformProvider = LinkedinLoginProvider.PROVIDER_ID;
    }
    
    this.socialAuthService.signIn(socialPlatformProvider).then(
      (userData) => {

        console.log(userData);

            
      }
    );
  }

}

```

### Facebook App Id : 

You need to create your own facebook app by going to [Facebook Developers](https://developers.facebook.com/) 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](https://developers.google.com/identity/sign-in/web/devconsole-project).

---
_Source: https://npm.io/package/ng-dynami-social-login · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
