# ng8-social-login

> This a simple, easy to use social login module.

Latest version **8.0.1** (published 2019-09-09) · 0 weekly downloads

## Install

```sh
npm install ng8-social-login
pnpm add ng8-social-login
yarn add ng8-social-login
bun add ng8-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 | 8.0.1 |
| Published | 2019-09-09 |
| First published | 2019-09-09 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 225.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Balázs Wermer |
| Maintainers | jpalmer42 |
| Keywords | angular, google, facebook, login, authentication, angular2, angular4, angular5, angular6, angular7, angular8, angular-social-login, social-authentication, social-login, google-authentication, facebook-authentication, ngx-social-login |

## Links

- npm: https://www.npmjs.com/package/ng8-social-login
- npm.io page: https://npm.io/package/ng8-social-login

## Dependencies (1)

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

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@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

## Recent versions

- 8.0.1 (latest) — 2019-09-09

## README

# NgxSocialLogin [![npm version](https://badge.fury.io/js/ngx-social-login.svg)](https://badge.fury.io/js/ngx-social-login)

This module's intention is to provide an easy to use social login service, which can be integrated easily into any environment.

This project has been inspired by [Angularx Social Login](https://github.com/abacritt/angularx-social-login)

## Getting started

### Install via npm/yarn

```sh
npm install --save ng8-social-login
```

```sh
yarn add ng8-social-login
```

### Import the module

Import `NgxSocialLoginModule` into your `Module`.
You can provide any configuration that is supported by Oauth providers.

Google:

-   https://developers.google.com/identity/sign-in/web/reference#gapiauth2clientconfig

Facebook:

-   https://developers.facebook.com/docs/javascript/reference/FB.init/v2.12
-   https://developers.facebook.com/docs/reference/javascript/FB.login/v2.12#params

```javascript
@NgModule({
    declarations: [ ... ],
    imports: [
        ...
        NgxSocialLoginModule.init(
            {
                google: {
                    client_id: 'YOUR_CLIENT_ID'
                },
                facebook: {
                    initOptions: {
                        appId: 'YOUR_APP_ID'
                    }
                }
            }
        )
        ...
    ],
    providers: [ ... ]
})
export class AuthModule {
}
```

### How to use

```javascript
@Component({
  selector: 'app-login-page',
  templateUrl: './app-login-page.component.html',
  styleUrls: ['./app-login-page.component.css']
})
export class LoginPageComponent {

    constructor(private _service: SocialLoginService) {}

      loginWithFacebook(): void {
          this._service.login(Provider.FACEBOOK).subscribe(user => console.log(user));
      }

      loginWithGoogle(): void {
          this._service.login(Provider.GOOGLE).subscribe(user => console.log(user));
      }

      logout(): void {
          this._service.logout().subscribe({
               complete: ()=> console.log('Logout success'),
               error: err => console.log(err)
           });
      }

}
```

### Demo

```bash
git clone https://github.com/wermerb/ngx-social-login.git
cd ng8-social-login
Add your Google and/or Facebook client id to AppModule's config
yarn / npm install
ng serve
```

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