npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ekiras-angular-social-auth

v1.0.1

Published

Angular 4 Social Login with facebook, Linkedin , Google, Instagram etc

Downloads

13

Readme

ekiras-angular-social-auth

This Plugin will work with Angular version ^4.0.0. It provides three basic functionalities

  1. Login
  2. Status
  3. Logout

Installation

To install this library, run:

$ npm install ekiras-angular-social-auth --save

Setup

You need to include the EkirasSocialAuthModule in the main module of your project.

Including Module in the main module of the Angular Project.

If you want to include the EkirasSocialAuthModule in the main module of the project, then you can do so as follows.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { EkirasSocialAuthModule } from 'ekiras-angular-social-auth';

@NgModule({
  declarations: [
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,

    // inlcude EkirasSocialAuthModule in the main module
    EkirasSocialAuthModule.forRoot({
      facebook: {
        appId: '<app-id>',
        options: {
          scope: '<permissions>'
        }
      }
    })
  ]
})
export class AppModule {

}

Including the Module in Shared Module of the Angular Project.

If you want to include the EkirasSocialAuthModule in a shared moduled, then you can include the module as follows


import { NgModule } from '@angular/core';
import { EkirasSocialAuthModule } from 'ekiras-angular-social-auth';

@NgModule({
  declarations: [
  ],
  imports: [

    // inlcude EkirasSocialAuthModule in the main module
    EkirasSocialAuthModule.forRoot({
      facebook: {
        appId: '<app-id>',
        options: {
          scope: '<permissions>'
        }
      }
    })
  ],
  exports: [
    EkirasSocialAuthModule
  ]
})
export class SharedModule {

}

Configuring the Module

You can configure the module with the following social provider's configurations.

Facebook Configurations.

| Option | Description | Default Value | |--------| --------|---------------| |appId | facebook app id| Mandatory (no default value)| |version| facebook sdk version| 'v2.8' | |async| If the facebook sdk should be loaded asynchronously| true| |cookie| Enable cookies to allow the server to access the session| true| |xfbml| parse social plugins on this page | true| |options

  1. scope
  2. returnScopes | Provide the comma separated scopes or pemissions for which the data will be fetched | public_profile | |options.returnScopes|the granted scopes will be returned in a comma-separated list in the grantedScopes| false|

Including SocialAuthService.

SocialAuthService

import { Component } from '@angular/core';
import { SocialAuthService, FacebookUserData } from 'ekiras-angular-social-auth';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

  data: FacebookUserData;

  constructor(private socialAuthService: SocialAuthService) {

  }

  public login(provider: string) {
    this.socialAuthService.login(provider).subscribe((data: FacebookUserData) => {
       // {FacebookUserData} user data
    });
  }

  public status(provider: string) {
    this.socialAuthService.status(provider).subscribe((status: boolean) => {
      //  boolean status
    });
  }

  public logout(provider: string) {
    this.socialAuthService.logout(provider).subscribe((status: boolean) => {
      // boolean status
    });
  }

}

app.component.html


<button (click)="login('facebook');">Fb Login</button>
<button (click)="status('facebook');">Fb Status</button>
<button (click)="logout('facebook');">Fb Logout</button>

License

MIT © Ekansh Rastogi