File

projects/commons/src/lib/elements/social-login/services/social-login.service.ts

Index

Methods

Constructor

constructor(socialAuthService: SocialAuthService)
Parameters :
Name Type Optional
socialAuthService SocialAuthService No

Methods

Public authState
authState()
Returns : Observable<SocialUser>
Public signOut
signOut()
Returns : void
Public singInWithFacebook
singInWithFacebook()
Returns : void
Public singInWithGoogle
singInWithGoogle()
Returns : void
import { Observable } from 'rxjs';
import { Injectable } from '@angular/core';

import {
    AuthService as SocialAuthService,
    FacebookLoginProvider,
    GoogleLoginProvider,
    SocialUser
} from 'angularx-social-login';

@Injectable()
export class SocialLoginService {
    constructor(private readonly socialAuthService: SocialAuthService) {}

    public authState(): Observable<SocialUser> {
        return this.socialAuthService.authState;
    }

    public singInWithGoogle(): void {
        this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID);
    }

    public singInWithFacebook(): void {
        this.socialAuthService.signIn(FacebookLoginProvider.PROVIDER_ID);
    }

    public signOut(): void {
        this.socialAuthService.signOut();
    }
}

result-matching ""

    No results matching ""