capacitor-community / facebook-login

Facebook Login support
MIT License
103 stars 52 forks source link

Logout throws FB is not defined #58

Closed selcukbeyhan closed 3 years ago

selcukbeyhan commented 3 years ago

Hello,

my application supports login via Google, Apple and Facebook. When I test the application in browser (ionic serve), the login works but when Logout is called, as follows below, an error is raised.

if (this.authProvider == 'google') { this.google.logout().then(outVal => { console.log('Google logout successful'); console.log(JSON.stringify(outVal)); }).catch(outError => { console.log('Google logout failed'); console.log(JSON.stringify(outError)); }); } else if (this.authProvider == 'facebook') { FacebookLogin.logout().then(outVal => { console.log('Facebook logout successful'); console.log(JSON.stringify(outVal)); }).catch(outError => { console.log('Facebook logout failed'); console.log(JSON.stringify(outError)); }); } if (this.authProvider == 'apple') { this.google.logout().then(outVal => { console.log('Apple logout successful'); console.log(JSON.stringify(outVal)); }).catch(outError => { console.log('Apple logout failed'); console.log(JSON.stringify(outError)); }); }

This is the error message: Capacitor WebPlugin "FacebookLogin" config object was deprecated in v3 and will be removed in v4. index.js:296 ERROR Error: Uncaught (in promise): ReferenceError: FB is not defined logout/<@http://localhost:8100/web.js:46:13 ZoneAwarePromise@http://localhost:8100/polyfills.js:4066:33 logout@http://localhost:8100/web.js:45:16

selcukbeyhan commented 3 years ago

It seems, I was following the Capacitor v3 instructions. Then I realized the README for Capacitor v2. I followed the instructions there. It works now.