heresy / angular2-social-login-example

angular2-social-login Example
13 stars 17 forks source link

FB not defined #4

Closed slegaitis closed 7 years ago

slegaitis commented 7 years ago

Hey,

Quick one for you. So I followed your instructions on how to implement this. Below is my set up:

login component html

<ul class="social-logins">
                <li>
                    <button (click)="socialLogin('facebook')"><span class="icon-facebook"></span></button>
                </li>
                <li>
                    <button (click)="socialLogin('google')"><span class="icon-google-plus"></span></button>
                </li>
                <li>
                    <button (click)="socialLogin('linkedin')"><span class="icon-linkedin"></span></button>
                </li>
            </ul>

login component

socialLogin(provider: string) {

        this.sub = this._auth.login(provider)
            .subscribe (
                (data) => {
                    console.log(data);
                }
            )
    }

index.ts

import { Angular2SocialLoginModule } from "angular2-social-login";
let providers = {
        "google": {
            "clientId": ""
        },
        "linkedin": {
            "clientId": ""
        },
        "facebook": {
            "clientId": "",
            "apiVersion": "v2.9"
        }
    };

@NgModule({
    imports: [
        Angular2SocialLoginModule,

I Get an error: login.component.html:35 ERROR ReferenceError: FB is not defined

Where am I going wrong? Same for linked in and google logins. Google returns gapi is not defined and linked in "in" is not defined.

kurapatijayaram commented 7 years ago

@tauciokas provide clientId's and try

slegaitis commented 7 years ago

Ive provided the clientID just didnt include them here

kurapatijayaram commented 7 years ago

Did you added this :

Angular2SocialLoginModule.loadProvidersScripts(providers);

after the main module defenition ?

slegaitis commented 7 years ago

Probably not. I'll check now

slegaitis commented 7 years ago

Yes that seemed to have worked. Thanks