capacitor-community / facebook-login

Facebook Login support
MIT License
103 stars 54 forks source link

ReferenceError: Can't find variable: FB #50

Closed antonellogatto closed 3 years ago

antonellogatto commented 3 years ago

Describe the bug I don't know if it is a bug or if I made something wrong. I installed the plugin for a Ionic - React + Capacitor 3 mobile app (no web). I followed all the steps. Then when I call

FacebookLogin.login({
    permissions: ['public_profile', 'email'],
});

then i receive the error "ReferenceError: Can't find variable: FB" I'm just using it with iOS or Android App so I don't think I need the web initialization. It worked before I updated to Capacitor 3 and uninstalled old @rdlabo/capacitor-facebook-login package.

To Reproduce I created a script file facebook.js to archive all facebook plugin links. This is how it appear my facebook.js file:

import { FacebookLogin } from '@capacitor-community/facebook-login';

const FACEBOOK_PERMISSIONS = ['public_profile', 'email'];

export function getAccessToken() {
    return FacebookLogin.login({
        permissions: FACEBOOK_PERMISSIONS,
    });
}

then in my redux saga file i call the getAccessToken() function in this way: const tokenResponse = yield call(getAccessToken);

Expected behavior I expect to prompt the Facebook Login in browser/app. It worked before I updated to Capacitor 3 and uninstalled old @rdlabo/capacitor-facebook-login package.

Desktop (please complete the following information):

Smartphone (please complete the following information):

UPDATE

My error, I forgot to build the code with react-scripts build before copy it to ios.