GithubHelp home page GithubHelp logo

capacitor-community / facebook-login Goto Github PK

View Code? Open in Web Editor NEW
92.0 92.0 45.0 3.49 MB

Facebook Login support

License: MIT License

Ruby 3.89% Java 41.06% Objective-C 4.57% Swift 22.16% JavaScript 2.00% TypeScript 26.32%

facebook-login's People

Contributors

allcontributors[bot] avatar bennyt2 avatar bj1024 avatar codeconsole avatar dependabot[bot] avatar iamrsojitra avatar leo6104 avatar nodonisko avatar prashantchoudhary avatar rdlabo avatar sebdej avatar stewones avatar vildhjarta8 avatar whitersun avatar yukikwi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facebook-login's Issues

Facebook doesn't support anymore htpp but https only.

I tried to Facebook login with my browser and it raises the method FB.login can no longer be called from http pages.

I think it is no longer possible to test Facebook login in development test like http://localhost because I created an app and users test but I was not able to disable enforce https .

Thanks

Ionic 4 Android Studio build error.

When I am trying to build ionic app in Android Studio after adding the registerPlugin()(as stated in docs) statement it throws error in build process.

For more information I have attached the screenshot.

Screenshot 2021-06-12 at 7 25 23 PM

ReferenceError: Can't find variable: FB

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):

  • OS: macOS Big Sur

Smartphone (please complete the following information):

  • Device: iPhone X Simulator
  • OS: iOS 12.0

UPDATE

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

Android "FB is not defined"

Describe the bug
RemoteJS return FB is not defined on complied app running on android. I follow read me guide for android (with out MainActivity step because capacitor3 didn't need it)

Smartphone (please complete the following information):

  • Device: Xiaomi mi 10
  • OS: Android 11
  • Capacitor 3
  • Plugin Version 1.1.0

podspec file is not included in next version ('3.0.0-1')

Describe the bug
Thank you for preparing capacitor v3 :)

I tested it with npm i @capacitor-community/facebook-login@next and found this problem in iOS.

image

Can you include CapacitorCommunityFacebookLogin.podspec file in npm package?

Expected behavior
Include podspec file.

Logout throws FB is not defined

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

Unable to get Facebook profile photo anymore

Describe the bug
Hi, I' having issue to get facebook user profile photo recently, it was working just fine previously.
Any idea what is the issue?

To Reproduce

  1. Authenticate a new facebook user
  2. And it return only the blank facebook user profile image.

Expected behavior
Expected to received user profile photo as previously.

Screenshots
If applicable, add screenshots to help explain your problem.
https://scontent.fkul17-1.fna.fbcdn.net/v/t1.30497-1/cp0/c15.0.50.50a/p50x50/84628273_176159830277856_972693363922829312_n.jpg?_nc_cat=1&_nc_sid=12b3be&_nc_ohc=avjs1eN81qIAX8LLQ-r&_nc_ht=scontent.fkul17-1.fna&_nc_tp=27&oh=7bc5a81b88f6a922b745b3c87f29808d&oe=5FA4D0B8

Additional context
Ionic:

Ionic CLI : 6.11.11 (/Users/.../.nvm/versions/node/v12.16.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.3.4
@angular-devkit/build-angular : 0.1001.4
@angular-devkit/schematics : 10.1.4
@angular/cli : 10.1.4
@ionic/angular-toolkit : 2.3.3

Capacitor:

Capacitor CLI : 2.4.2
@capacitor/core : 2.4.2

Utility:

cordova-res : 0.15.1
native-run : 1.2.1

System:

NodeJS : v12.16.1 (/Users/.../.nvm/versions/node/v12.16.1/bin/node)
npm : 6.14.8
OS : macOS Catalina

Get email using Vue

I'm using Quasar App (Vue) with Capacitor.

First, import the plugin:

import { Plugins } from '../../../src-capacitor/node_modules/@capacitor/core'; import '../../../src-capacitor/node_modules/@capacitor-community/facebook-login';

Then I can get login from fb:

const FACEBOOK_PERMISSIONS = ['email']; const result = await Plugins.FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS })

This works fine (I get client_id, token, etc), but I can't get the email field.

Then, I want to use getProfile function to get it, but

const result = await FacebookLogin.getProfile<{ email: string; }>({ fields: ['email'] });

is Typescript, not Vue.

If I change it to

const resultProfile = Plugins.FacebookLogin.getProfile({ fields: ['email'] });

i have an error: Facebook user's email is undefined

Any way to get email field without typescript?

  • OS: iOS

Plugin crashes on iOS 11.0.* and 11.1.*

Describe the bug
Launching an app with this plugin crashes during startup if ran on iOS 11.0 or 11.1 devices.

To Reproduce
Steps to reproduce the behavior:

  1. Implement the facebook-login pod
  2. Run on a device with iOS 11.0 or 11.1
  3. Application crashes in splash-screen with
Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: 'Invalid parameter not satisfying: formatOptions == 0 
  || !(formatOptions & ~(NSISO8601DateFormatWithYear 
  | NSISO8601DateFormatWithMonth 
  | NSISO8601DateFormatWithWeekOfYear 
  | NSISO8601DateFormatWithDay 
  | NSISO8601DateFormatWithTime 
  | NSISO8601DateFormatWithTimeZone 
  | NSISO8601DateFormatWithSpaceBetweenDateAndTime 
  | NSISO8601DateFormatWithDashSeparatorInDate 
  | NSISO8601DateFormatWithColonSeparatorInTime 
  | NSISO8601DateFormatWithColonSeparatorInTimeZone 
  | NSISO8601DateFormatWithFullDate 
  | NSISO8601DateFormatWithFullTime 
  | NSISO8601DateFormatWithInternetDateTime)
)'

Expected behavior
Not crashing and continuing the application.

Screenshots
N/A

Smartphone

  • Device: iPhone 6
  • OS: iOS 11.1
  • Version 15B93

Additional context
Issue originates here:

if #available(iOS 11, *) {

Super simple solution is explained here https://stackoverflow.com/a/59892014/1531122
Editing the the line to read #available(iOS 11.2, *) indeed fixes the issue for me.

(my experience with Swift is shorter than me typing this bug-report, so I don't feel comfortable yet to make this a PR)

Ionic 5 Facebook Login

Hello,
i'm using the capacitor facebook login with an ionic 5 app.
this is a snippet of my code:

`
import { Plugins } from '@capacitor/core';

export class WelcomePage implements OnInit {

constructor(private router: Router) {}
async fbLogin() {
const FACEBOOK_PERMISSIONS = ['public_profile', 'email'];
const result = await Plugins.FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS });

  if (result && result.accessToken) {
    let user = { token: result.accessToken.token, userId: result.accessToken.userId }
    let navigationExtras: NavigationExtras = {
      queryParams: {
        userinfo: JSON.stringify(user)
      }
    };
    this.loginFacebook(result, navigationExtras)
  }
}

loginFacebook(res, navigationExtras) {
console.log(res);
console.log(navigationExtras);

var headers = new Headers();
headers.append("Accept", 'application/json');
headers.append('Content-Type', 'application/json');
const requestOptions = new RequestOptions({ headers: headers });

let postData = {
  "utente": {
  },
  "credentials": {
    "identifier": res.userID,
    "secret": res.accessToken
  }

}

this.http.post(this.restServices.loginFb, postData, requestOptions)
  .subscribe(data => {
    this.token = data['_body'];
    this.storage.set('token', this.token).then((val) => {
      this.storage.set('username', navigationExtras.email).then((val) => {
        this.router.navigate(['/home']);
      });
    });

  }, error => {

console.log(error);
});
}
}
`

But the only values i'm getting back inside userinfo are token and userId, i got no name or surname and no email address.

What am I doing wrong?

thanks!

Undefined symbol: _OBJC_CLASS_$_FBSDKAccessToken/FBSDKLoginManager

Bug in IOS version or am I missing something.

Describe the bug
I followed all the steps to use the plugin and it worked fine for android.
However for IOS I got the error shown in the screenshot below .
I also took the steps I could find in the provided link in the readme for facebook login guide in ios just before the bundle id part.
I set up your development environment using Cocoapods, and then tried again but get the same error.

To Reproduce
Steps to reproduce the behavior:

  1. Create an ionic capacitor project
  2. Run 'yarn build' and 'npx cap add ios'
  3. Do all necessary configurations for the plugin to work for ios
  4. pod 'FBSDKLoginKit' in the Podfile and then run pod install
    5.Run npx cap sync ios
  5. Run project in xcode

Expected behavior
I expect the build to finish and an emulator to be opened

Screenshots
error

Desktop (please complete the following information):

  • OS: MacOs Mojave version 10.14.4 VM in Ubuntu 19.10
  • Browser firefox
  • Version 81.0

Thank you.

[!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit":

When running "npx cap sync" or "pod install" directly in ios/App i get the following error:

[!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit":
  In Podfile:
    CapacitorCommunityFacebookLogin (from `../../node_modules/@capacitor-community/facebook-login`) was resolved to 3.1.1, which depends on
      FBSDKCoreKit (~> 11.0.0)

    CordovaPluginsStatic (from `../capacitor-cordova-ios-plugins`) was resolved to 3.2.3, which depends on
      FBSDKCoreKit (= 11.1.0)

CordovaPluginsStatic.podspec

  Pod::Spec.new do |s|
    s.name = 'CordovaPluginsStatic'
    s.version = '3.2.3'
    s.summary = 'Autogenerated spec'
    s.license = 'Unknown'
    s.homepage = 'https://example.com'
    s.authors = { 'Capacitor Generator' => '[email protected]' }
    s.source = { :git => 'https://github.com/ionic-team/does-not-exist.git', :tag => '3.2.3' }
    s.source_files = 'sourcesstatic/**/*.{swift,h,m,c,cc,mm,cpp}'
    s.ios.deployment_target  = '12.0'
    s.xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1 WK_WEB_VIEW_ONLY=1' }
    s.dependency 'CapacitorCordova'
    s.swift_version  = '5.1'
    s.static_framework = true
    s.dependency 'FBSDKCoreKit', '11.1.0'
    s.dependency 'FBSDKLoginKit', '11.1.0'
    s.dependency 'FBSDKShareKit', '11.1.0'
    s.dependency 'GoogleSignIn', '~> 5.0.2'
    s.dependency 'GoogleUtilities', '~> 7.2.2'
    s.dependency 'OneSignal', '2.16.5'
    s.weak_frameworks = 'AddressBook', 'CoreText', 'SafariServices', 'Security', 'SystemConfiguration'
    s.frameworks = 'SystemConfiguration'
    s.libraries = 'z'
  end

CapacitorCommunityFacebookLogin.podspec

require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
  s.name = 'CapacitorCommunityFacebookLogin'
  s.version = package['version']
  s.summary = package['description']
  s.license = package['license']
  s.homepage = package['repository']['url']
  s.author = package['author']
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
  s.ios.deployment_target  = '12.0'
  s.swift_version = '5.1'
  s.static_framework = true
  s.dependency 'Capacitor'
  s.dependency 'FBSDKCoreKit', '~> 11.0.0'
  s.dependency 'FBSDKLoginKit', '~> 11.0.0'
end

The specs in capacitor-cordova-plugin doesnt match the ones in capacitor-comunity/facebook.
I could not find a way of downgrading capacitor-cordova-plugin-ios and also there is no update for the facebook-login.
If i manually change the version inside capacitor libs its works, however its will be lost every time i run npm.
Is there any permanet solution to this problem?

Ionic:

Ionic CLI : 6.18.1 (/Users/fabricadesoftware/.npm-global/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.8.0
@angular-devkit/build-angular : 0.1101.4
@angular-devkit/schematics : 11.1.4
@angular/cli : 11.1.4
@ionic/angular-toolkit : 4.0.0

Capacitor:

Capacitor CLI : 3.2.3
@capacitor/android : 3.2.3
@capacitor/core : 3.3.2
@capacitor/ios : 3.3.2

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (1 plugins total)

Utility:

cordova-res : not installed globally
native-run (update available: 1.5.0) : 1.4.1

System:

NodeJS : v16.13.0 (/usr/local/bin/node)
npm : 8.1.0
OS : macOS Monterey
Xcode : Xcode 13.1 Build version 13A1030d

Use of unresolved identifier 'ApplicationDelegateProxy'

Hello,

when I use the following line as described in the README:
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)

My XCode returns an error:
Use of unresolved identifier 'ApplicationDelegateProxy'

I have XCode Version 11.6 (11E708)

Is it normal?

Thanks.

'Sorry, something went wrong' facebook screen

Describe the bug
Whenever clicking on a button that fires the facebook login function I get redirected to facebook but instead of a login screen I get a screen saying that something when wrong.

Sorry, something went wrong. We are working on it and we'll get it fixed as soon as we can.

I've noticed that I'm not the only encountering this issue, as someone on this post made in the old repo shows exactly the same problem I'm having, but for iOS.
I've been having this when installing the plugin from the old repo and also when installing it from here.

To Reproduce
Run your function where Plugins.FacebookLogin.login() is triggered.

Expected behavior
A facebook page showing login form

Screenshots
https://pasteboard.co/JgpRo2y.jpg

Smartphone
Samsung S8 SM-G950F
Android 9

Login error with {"code":"UNIMPLEMENTED"}

Hello, for the following code below:
`const FACEBOOK_PERMISSIONS = ['email'];
Plugins.FacebookLogin.login({permissions: FACEBOOK_PERMISSIONS}).then((response:FacebookLoginResponse)=> {
console.log('Login successful');
console.log(JSON.stringify(response));

            }).catch((error)=>{
                console.log('Login error');
                console.log(JSON.stringify(error));
            });`

I get following error in XCode when I run on simulator. I didn't test on a device. (with browser - ionic serve - the login works)
⚡️ [log] - Login error
⚡️ [log] - {"code":"UNIMPLEMENTED"}

I was following the sample here:
https://enappd.com/blog/facebook-login-in-capacitor-apps-with-ionic-angular/128/

What can be the reason of this error message?

Thanks.

Facebook has detected [Project Name] isn't using a secure connection to transfer information.

I'm using this plugin to be able to login with Facebook using my mobile app. However, after upgrading to version 3 of Ionic Capacitor, the plugin stopped working on my Android device.

Steps done:

  1. Created App from Facebook Developers page.
  2. Added App ID to Strings.xml
  3. Added meta-data values to Android Manifest
  4. Imported the "com.getcapacitor.community.facebooklogin.FacebookLogin" package to MainActivity.java even though it's not required. Just to make sure that I've tried everything.

What could possibly go wrong? Are there things I may have missed?

Option to force sign-in page ? (To change account?)

Hello, is there a way to force the display of "Sign in as John Doe ?" in the facebook page as a confirmation screen before continuing ? Because right now, if any facebook user is logged in, then this user is automatically logged in my app, without giving the choice to change account. Even after calling FacebookLogin.logout().

CocoaPods could not find compatible versions for pod FBSDKCoreKit

Hi, I recently updated the version of this package on my app to v2 and when I tried to build the app, it says:

[!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit": In Podfile: CapacitorCommunityFacebookLogin (from../../node_modules/@capacitor-community/facebook-login`) was resolved to 1.1.0, which depends on
FBSDKCoreKit (= 9.0.1)

FBSDKCoreKit

Specs satisfying the FBSDKCoreKit, FBSDKCoreKit (= 9.0.1) dependency were found, but they required a higher minimum deployment target
`
I have updated the appDelegate.swift file according to the documentation. Did I miss out anything?

Doesn't work after capacitor 3.0.0-beta.2

Describe the bug
A clear and concise description of what the bug is.
image
It seems FacebookLogin variable treated as web plugin.

To Reproduce
Install 3.0.0-beta.2 core / android / ios and this plugin.

Expected behavior
It should be Proxy object.

Desktop (please complete the following information):

  • OS: Android, iOS
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
after capacitor 3.0.0-beta.2, registerWebPlugin function is deprecated.

Now, we should use registerPlugin function like this.

import { registerPlugin } from '@capacitor/core';
const FacebookLogin = registerPlugin<FacebookLoginPlugin>('FacebookLogin', {
  web: new FacebookLoginWeb(),
});
export { FacebookLogin };

How is this supposed to work with Vue?

Describe the bug
It is not a bug I think, it is more a missing documentation to let it work.

const result = await <FacebookLoginResponse>FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS });

This block of code doesn't work on Vue.js obviously because of the <FacebookLoginResponse>.

So far I tried to just remove it, but it doesn't work:

const result = await FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS });

I tried to let it work like on the Google one, but it doesn't work:

import { Plugins } from '@capacitor/core'
...
const result = await Plugins.FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS });

The error I get is the following: Error: {"code":"UNIMPLEMENTED"}

Is it possible to let it work for normal Javascript? Thanks

To Reproduce
Steps to reproduce the behavior:

  1. Use it with Vue.js

Is it possible to retrieve the current logged-in profile from the plugin?

Is your feature request related to a problem? Please describe.
Our backend requires the email and assigns a Facebook access token to an existing user using the email. Sadly, we cannot change this behavior because we don't have versioning right now and have a couple of clients who can fetch the current FB user without difficulties.

Describe the solution you'd like
Does the behavior where the plugin returns, for example, the result of the Graph API to the /me call after the sign-in and/or provide the method to call it manually

Describe alternatives you've considered
It looks like if contributors will decide that this is out of the plugin scope, maybe another plugin to perform the Graph API requests required.

PS.
I can try to create PR if this kind of functionality will be OK for this plugin.

Thank you.

Problem on Android 11 and SDK 30

Hello, i'm opening this bug report because i've just found a weird issue.

I'm developing an App and 'm testing it on Android 11 .

Google Play Store will require soon to release app with SDK 30 (READ MORE HERE )but, if I choose this version, when I try to login i get this error message:

image

If i revert back to SDK 29 it works again.

image

Do you know if there is something missing in the configuration?

Thank you

FIX

The problem was in my node_modules folder, probably the update didn't work correctly and it was still working with the old 1x version files.

After removing it and installing again it works fine.

Android configuration

Describe the bug
When I change MainActivity class gives an error

To Reproduce
Change MainActivity.java and add/override:

public class MainActivity extends BridgeActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        registerPlugin(com.getcapacitor.community.facebooklogin.FacebookLogin.class);
    }
}

Then, when I do nix cap open android:

error: cannot find symbol
    public void onCreate(Bundle savedInstanceState) {
                         ^
  symbol:   class Bundle
  • OS:Android

issue after work on phone.

Describe the bug
A clear and concise description of what the bug is.

Description
After using android studio build Debug and APK app. I got success app-debug.apk. But the problem I was installed into my phone and unable open the app.
System always calling for "Unfortunately has stopped."

To Reproduce
Steps to reproduce the behavior:

  1. After build apk from android studio and follow the step was on readme tutorial taught.
  2. Download to mobile phone and install.
  3. After click the app, app open and got black screen. Pass Through not enough 1 mins, app automatic exits
  4. See error system calling "Unfortunately has stopped."

Expected behavior
App should correctly open and working well.

Screenshots
If applicable, add screenshots to help explain your problem.

340602

Framework

  • Ionic vue3
  • Capacitor Platform

Smartphone (please complete the following information):

  • Device: Galaxy Samsung Prime 7
  • OS: Android
  • Browser none
  • Version none

Additional context
Add any other context about the problem here.

Serious error executing plugin when login asking for manage permissions

I'm trying to get some manage permissions with the login operation, but I always get the same error:
Caused by: Cannot pass a publish or manage permission (ads_management) to a request for read authorization

In the login method you are using the api call:
LoginManager.getInstance().logInWithReadPermissions(this.getActivity(), permissions);

It would be possible to use the method
LoginManager.getInstance().logIn(this.getActivity(), permissions);
that also is available in the api?

The full stacktrace that I get is:

2021-05-19 23:20:05.808 23949-24286/com.ionicframework.metric2020l E/Capacitor: Serious error executing plugin
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
at com.getcapacitor.Bridge$1.run(Bridge.java:542)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: Cannot pass a publish or manage permission (ads_management) to a request for read authorization
at com.facebook.login.LoginManager.validateReadPermissions(LoginManager.java:525)
at com.facebook.login.LoginManager.logInWithReadPermissions(LoginManager.java:396)
at com.getcapacitor.community.facebooklogin.FacebookLogin.login(FacebookLogin.java:183)
at java.lang.reflect.Method.invoke(Native Method) 
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99) 
at com.getcapacitor.Bridge$1.run(Bridge.java:542) 
at android.os.Handler.handleCallback(Handler.java:808) 
at android.os.Handler.dispatchMessage(Handler.java:101) 
at android.os.Looper.loop(Looper.java:166) 
at android.os.HandlerThread.run(HandlerThread.java:65) 
2021-05-19 23:20:05.818 23949-24286/com.ionicframework.metric2020l E/AndroidRuntime: FATAL EXCEPTION: CapacitorPlugins
Process: com.ionicframework.metric2020l, PID: 23949
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.getcapacitor.Bridge$1.run(Bridge.java:551)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
at com.getcapacitor.Bridge$1.run(Bridge.java:542)
at android.os.Handler.handleCallback(Handler.java:808) 
at android.os.Handler.dispatchMessage(Handler.java:101) 
at android.os.Looper.loop(Looper.java:166) 
at android.os.HandlerThread.run(HandlerThread.java:65) 
Caused by: Cannot pass a publish or manage permission (ads_management) to a request for read authorization
at com.facebook.login.LoginManager.validateReadPermissions(LoginManager.java:525)
at com.facebook.login.LoginManager.logInWithReadPermissions(LoginManager.java:396)
at com.getcapacitor.community.facebooklogin.FacebookLogin.login(FacebookLogin.java:183)
at java.lang.reflect.Method.invoke(Native Method) 
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99) 
at com.getcapacitor.Bridge$1.run(Bridge.java:542) 
at android.os.Handler.handleCallback(Handler.java:808) 
at android.os.Handler.dispatchMessage(Handler.java:101) 
at android.os.Looper.loop(Looper.java:166) 
at android.os.HandlerThread.run(HandlerThread.java:65) 
2021-05-19 23:20:05.881 23949-24286/com.ionicframework.metric2020l I/Process: Sending signal. PID: 23949 SIG: 9

Regards
Marcos

Update FB SDKs to the latest versions (9)

Is your feature request related to a problem? Please describe.
The plugin currently uses old and deprecated/retired versions of the Facebook SDK for both iOS and Android. They are on version 5, while version 9 is out and Facebook is strongly urging to update to this one. Usage of version 5 creates compatibility issues with other plugins and SDKs that require later versions of FacebookCore, and additionally cannot take advantage of the iOS 14 changes related to tracking and data collection.

Describe the solution you'd like
Update Facebook dependencies to the latest versions, and change the Class/Method names to reflect the names in the new SDK.
For Android the maven dependency is com.facebook.android:facebook-login:8.1.0
For iOS the pod dependency is https://cocoapods.org/pods/FBSDKLoginKit

The migration guide for iOS can be found here: https://github.com/facebookarchive/facebook-swift-sdk/blob/master/MigrationGuide.md

Describe alternatives you've considered
I haven't considered any alternatives yet.

iOS Login with the Facebook app installed fails

Describe the bug
The AppDelegate function of the FBSDK refuses to handle the returned Intent.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the instructions in the Readmes
  2. Install on an iPhone with the FB app installed
  3. Open the login dialog
  4. When asked to open in the native app, do so
  5. Provide authorization, return to app
  6. See, that the dialog is not closed.

Expected behavior
The Dialog should close and provide the auth info to the app.

Smartphone (please complete the following information):

  • Device: all iPhones
  • OS: iOS 14

Additional context
Official Facebook app is required. Authorization through safari works just fine but is disabled when the app is installed.
Returned URL is (omitting IDs) fb***://authorize#denied_scopes=&granted_scopes=email%2Cpublic_profile&graph_domain=facebook&nonce=&signed_request=&state=%7B%22challenge%22%3A%22xn1%252FW870hI2L16%253D0EtIa87a6Wjo%253D%22%2C%220_auth_logger_id%22%3A%2212F0D8C6-***-304804A65CA4%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D

Unable to work on Android device

Describe the bug
Unable to work on Android device.

Here is the log from Android studio.

2020-10-08 10:33:47.226 13531-13768/... V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 56064832, pluginId: FacebookLogin, methodName: login
2020-10-08 10:33:47.226 13531-13531/... I/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 61747 - Msg: email
2020-10-08 10:33:47.226 13531-13768/... V/Capacitor: callback: 56064832, pluginId: FacebookLogin, methodName: login, methodData: {"permissions":["email"]}
2020-10-08 10:33:47.227 13531-13668/... D/Capacitor/FacebookLogin: Entering login()
2020-10-08 10:33:47.268 13531-13531/... I/HwSecImmHelper: mSecurityInputMethodService is null
2020-10-08 10:33:47.321 13531-13531/... D/Capacitor: App paused
2020-10-08 10:33:47.322 13531-13531/... D/ZrHung.AppEyeUiProbe: stop checker.
2020-10-08 10:33:47.382 13531-13531/... I/ViewRootImpl: jank_removeInvalidNode all the node in jank list is out of time
2020-10-08 10:33:47.385 13531-13531/... W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@db3679e
2020-10-08 10:33:47.386 13531-13531/... D/ZrHung.AppEyeUiProbe: notify runnable to start.
2020-10-08 10:33:47.388 13531-13531/... V/ActivityThread: Skipping new config:{1.0 502mcc153mnc [en_MY,ms_GB,zh_GB_#Hans,zh_TW_#Hant] ldltr sw360dp w360dp h709dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=Rect(0, 90 - 1080, 2218) mWindowingMode=fullscreen mActivityType=undefined} nonFullScreen=0 suim:1 s.10}, config:{1.0 502mcc153mnc [en_MY,ms_GB,zh_GB_#Hans,zh_TW_#Hant] ldltr sw360dp w360dp h709dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=Rect(0, 90 - 1080, 2218) mWindowingMode=fullscreen mActivityType=undefined} nonFullScreen=0 suim:1 s.10} for app:...
2020-10-08 10:33:47.397 13531-13531/... V/ActivityThread: callActivityOnCreate
2020-10-08 10:33:47.406 13531-13531/... I/HwPhoneWindow: updateLayoutParamsColor false mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=0, mNavBarShow=false, mIsFloating=false
2020-10-08 10:33:47.407 13531-13531/... I/HwPhoneWindow: updateLayoutParamsColor true mSpecialSet=true, mForcedNavigationBarColor=false, navigationBarColor=fffcfcfc, mNavBarShow=false, mIsFloating=false
2020-10-08 10:33:47.423 13531-13531/... D/ActivityThread: add activity client record, r= ActivityRecord{759367c token=android.os.BinderProxy@db3679e {.../com.facebook.FacebookActivity}} token= android.os.BinderProxy@db3679e
2020-10-08 10:33:47.447 13531-13531/... D/ZrHung.AppEyeUiProbe: notify runnable to start.

To Reproduce
Steps to reproduce the behavior:
After call await FacebookLogin.login({ permissions: FACEBOOK_PERMISSIONS })
it just stop without any response.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):
Android: 9.1.0

Plugin:
"@capacitor-community/facebook-login": "^1.0.2",

Ionic:
Ionic CLI : 6.11.11 (/Users/.../.nvm/versions/node/v12.16.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.3.4
@angular-devkit/build-angular : 0.1001.4
@angular-devkit/schematics : 10.1.4
@angular/cli : 10.1.4
@ionic/angular-toolkit : 2.3.3

Capacitor:

Capacitor CLI : 2.4.2
@capacitor/core : 2.4.2

Utility:

cordova-res : 0.15.1
native-run : 1.2.1

System:

NodeJS : v12.16.1 (/Users/.../.nvm/versions/node/v12.16.1/bin/node)
npm : 6.14.8
OS : macOS Catalina

Additional context
Add any other context about the problem here.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

Throws this error when attempting to buildrun:

Execution failed for task ':app:compileDebugJavaWithJavac'.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

Appears to be related to this... in MainActivity.java

public class MainActivity extends BridgeActivity {
@OverRide
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerPlugin(com.getcapacitor.community.facebooklogin.FacebookLogin.class);
}
}

Is this because I'm using Capacitor v3? (looks like there's an open topic on that so perhaps the plugin isn't supporting it yet). Should we just use cordova plug for facebook login on v3 or is there a fix expected soon?

Facebook Login changes beginning October 5, 2021

Facebook sent the following message on 21.08.2021:

We’ve been monitoring an increase in phishing attempts on Android embedded browsers, also known as WebViews. Because of this, we will no longer support this method of Facebook Login and your users will not be able to log in using Android embedded browsers beginning October 5, 2021. Until then, we will continue to prevent access to Facebook Login on embedded browsers for certain users we deem high-risk in an effort to prevent malicious activity.
To avoid a disrupted user experience, please use the following checklist:

  1. Ensure that you have upgraded to version 8.2.0 (or later) of the Facebook SDK for Android. If your app is built to target Android 11 (API level 30) and your users are on Android 11, alternative non-webview login mechanisms provided by the SDK will not work unless you upgrade to or past 8.2.0.
  2. Ensure that you are NOT setting LoginBehavior=WEB_VIEW_ONLY.
  3. Ensure that your app has configured support for Custom Tabs properly. (Not sure what Custom Tabs are? Check here.) To test this, ensure that you have a browser compatible with Custom Tabs (example browsers that support Custom Tabs include Chrome, Samsung Browser, etc). Next, delete the Facebook app from your device if you have it installed. Finally, login from your app. You should see a window open in the external browser rather than in a native WebDialog.
    If you do not see an external browser launch, follow these instructions:
    Option 1:
    Ensure your app is using version 8.2.0 or later of the Facebook SDK for Android. If so, you should not need to make any modifications to your Android manifest. If you have any items referencing “CustomTabMainActivity” or “CustomTabActivity”, remove them.
    Option 2:
    Configure your Custom Tabs intent filter exactly following the instructions here.
    Try Option 1 first and then use Option 2 if Option 1 does not work after testing. There may be cases where we cannot automatically configure your intent filter because of mismatches between the defined ${applicationId} constant and your package name.
  4. If you have already completed steps 1-3 and have released your app to users, users who are on older versions of your application will see an error message when they attempt to login from a webview, prompting them to upgrade to the newest version of your application. If you have mechanisms to force auto-upgrades for existing installations of your application or to prompt your users to upgrade, we encourage you to use them to limit affected users.
  5. If your app is used primarily on devices which are unable to host the login experience in an external browser, we encourage you to integrate Device Login as an alternative login mechanism.

How will this effect capacitor apps? Will it still be possible to provide a login via Facebook?

E/GraphResponse: {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException...

Describe the bug
After following all the steps as told I am receving this error

E/GraphResponse: {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Object with ID '277621683973226' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at ...

Why?

Does this library makes use of code_verifier and code_challenger?

Hi people who made this library,

First of all, awesome library!

I have successfully implemented Facebook login on Android and iOS using your library. While I was debugging your library, I couldn't find if a code_verifier and code_challenger is used in order to prevent malicious app's using your code (PKCE). I have implemented Google Login myself by following this guide where they explain using the code_verifier and code_challenger. So I was wondering does this library use PKCE by using a code_verifier and code_challenger?

Regards,

Bart

Popup Blocked on Safari Iphone PWA

Describe the bug

Hello, I used this cordova plugin before https://github.com/jeduan/cordova-plugin-facebook4 and switched to your's instead with capacitor v3.

Since I release the app, users on iOS or using safari desktop run into the "popup blocked" problem that is explained here: https://www.idownloadblog.com/2021/03/30/how-to-allow-pop-ups-in-safari/

The problem is that FacebookLogin.login gets stuck and never respond in the case popups are blocked (default setting).

How to handle this case? Is there a way to check if safari is setup correctly to allow FB login ?

thanks

To Reproduce
Steps to reproduce the behavior:

  1. Open safari on iphone or desktop with popups blocked
  2. try to login

Expected behavior

Get an Error to let the developers know that something got wrong and it is because of safari's setting.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOs at least
  • Browser: safari
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: iphone XS
  • OS: latest
  • Browse safari
  • Version [e.g. 22]

Type definitions not loaded

Describe the bug
I see that definitions.ts extends PluginRegister:

declare module '@capacitor/core' {
    interface PluginRegistry {
        FacebookLogin: FacebookLoginPlugin;
    }
}

However, for some reason, when I import this module and then import {Plugins} from @capacitor/core, Plugins.FacebookLogin is any.

Do you have any debugging advice? Here is my tsconfig:

{
    "exclude": ["node_modules"],
    "include": [
        "node_modules/@capacitor-community/facebook-login/dist/esm/definitions.d.ts"
    ],
    "compilerOptions": {
        "noEmit": true,
        "jsx": "react",
        "esModuleInterop": true,
        "types": [],
        "lib": ["DOM", "DOM.Iterable", "ESNext"],
        "target": "ES6",
        "module": "ESNext",
        "moduleResolution": "node",
        "strict": true,
        "forceConsistentCasingInFileNames": true,
        "resolveJsonModule": true,
        // Specified because required by `paths` setting below
        "baseUrl": "."
    }
}

You can see I tried adding it explicitly to includes, but no luck. Generally, though, adding it to include is only necessary if it's not being explicitly imported, at least that is my understanding and has been working for me. Am I missing something?

Thanks a lot for this module.

To Reproduce
No reproduction, just seeking troubleshooting advice if anything comes to mind. Please close this issue if nothing comes to mind.

Expected behavior
When I import the module, types should be read by the TypeScript compiler.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: [e.g. iOS] N/A
  • Browser [e.g. chrome, safari] N/A
  • Version [e.g. 22] N/A

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] N/A
  • OS: [e.g. iOS8.1] N/A
  • Browser [e.g. stock browser, safari] N/A
  • Version [e.g. 22] N/A

Additional context
Add any other context about the problem here.

Update documentation to information what import in gradle are needed

Hi,

I've used your library since one year. Few days ago I've updated project to official capacitor however it was no information about new version of facebook sdk in dependencies.

It is worth to mention for other developers that we should take care of facebook android sdk in android/app/build.gradle.

Latest one is implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
My eariler was implementation 'com.facebook.android:facebook-android-sdk:4.41.0' and it caused issue during compilation in android studio.

Please update documention if possible.

Thank you,
Piotr

FB Sdk versions supported by android and IOS

Hi. First of all, thanks for developing this as it has helped me a lot for my project. Getting into the issue directly, I have noticed in my facebook developer account that the android SDK is outdated. Just want to ask what are the SDK versions supported by this plugin? am I able to update the SDK versions as stated under the facebook developers like this?

For android
implementation 'com.facebook.android:facebook-android-sdk:8.1.0'

and pod update for ios?

[v3] Path to module in gradle.xml incorrectly set when working in monorepo

Describe the bug
I have installed the plugin according to v3's readme in our Ionic+Angular monorepo and have the following error when building my app:

error: package com.getcapacitor.community.facebooklogin does not exist
registerPlugin(com.getcapacitor.community.facebooklogin.FacebookLogin.class);

when running the app in Android Studio.

Upon further inspection I see that in projects/app/android/.idea/gradle.xml the path to the facebook-login module is incorrect:

<option name="modules">
  <set>
        <option value="$PROJECT_DIR$/../../../node_modules/@capacitor/android/capacitor" />
        <option value="$PROJECT_DIR$" />
        <option value="$PROJECT_DIR$/app" />
        <option value="$PROJECT_DIR$/capacitor-cordova-android-plugins" />
        <option value="$PROJECT_DIR$/../node_modules/@capacitor-community/facebook-login/android" />
  </set>
</option>

The project lies at /projects/app and therefore the import should point two folders higher.
I have tried editing the file directly but it gets rebuilt anyway and it didn't help.

Is this a plugin bug or some misconfiguration?
Thanks!

Desktop (please complete the following information):

  • OS: Android
  • Browser Chrome
"@capacitor-community/facebook-login": "^3.0.0-3",
"@capacitor/android": "^3.0.0-rc.0",

userId missing in web plugin

userId missing in web plugin. Current only return token. Need userId for parse server login.

ugly solution
call getCurrentAccessToken after login

FacebookLogin.login() Error performing query [extra].

Describe the bug
When doing a call to the method FacebookLogin.login() we get an error in the catch:

SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]: 
    at Object.fromNative (capacitor-runtime.js:226)
    at <anonymous>:1:18

Logcat error output when Login() is called:

2020-09-25 18:22:58.898 2803-2998/com.edubox.app D/Capacitor/FacebookLogin: Entering getCurrentAccessToken()
2020-09-25 18:22:58.898 2803-2998/com.edubox.app D/Capacitor/FacebookLogin: getCurrentAccessToken: accessToken is null
2020-09-25 18:22:58.913 2803-2803/com.edubox.app I/Capacitor/Console: File: http://localhost/main-es2015.js - Line 6272 - Msg: FacebookLogin.getCurrentAccessToken:  [object Object]
2020-09-25 18:22:58.913 2803-2998/com.edubox.app D/Capacitor/FacebookLogin: Entering login()
2020-09-25 18:22:58.934 2803-2803/com.edubox.app D/Capacitor: App paused
2020-09-25 18:23:00.152 2803-2803/com.edubox.app D/Capacitor/FacebookLogin: Entering handleOnActivityResult(64206, -1)
2020-09-25 18:23:00.154 2803-2803/com.edubox.app E/Capacitor/FacebookLogin: LoginManager.onError
    SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]: 
        at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:219)
        at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:174)
        at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:91)
        at com.getcapacitor.community.facebooklogin.FacebookLogin.handleOnActivityResult(FacebookLogin.java:137)
        at com.getcapacitor.Bridge.onActivityResult(Bridge.java:776)
        at com.getcapacitor.BridgeActivity.onActivityResult(BridgeActivity.java:214)
        at android.app.Activity.dispatchActivityResult(Activity.java:8310)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5008)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5056)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
2020-09-25 18:23:00.154 2803-2803/com.edubox.app D/Capacitor: Sending plugin error: {"save":false,"callbackId":"2090982","pluginId":"FacebookLogin","methodName":"login","success":false,"error":{"message":"SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]: "}}
2020-09-25 18:23:00.154 2803-2803/com.edubox.app D/Capacitor/FacebookLogin: onActivityResult succeeded
2020-09-25 18:23:00.155 2803-2803/com.edubox.app D/Capacitor/App: Firing change: true
2020-09-25 18:23:00.155 2803-2803/com.edubox.app D/Capacitor/App: No listeners found for event appStateChange
2020-09-25 18:23:00.169 2803-2803/com.edubox.app D/Capacitor: App resumed
2020-09-25 18:23:00.206 2803-2803/com.edubox.app D/Capacitor/Network: No listeners found for event networkStatusChange
2020-09-25 18:23:00.211 2803-2803/com.edubox.app I/Capacitor/Console: File: http://localhost/main-es2015.js - Line 6260 - Msg: Error logging into Facebook Error: SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]: 

To Reproduce
Steps to reproduce the behavior:

const loginFacebook = ():Promise<AuthSession> =>
{
            return new Promise((resolve, reject) => 
            {
                FacebookLogin.login({ permissions: ['public_profile', 'email'] }).then((authdata: FacebookLoginResponse) =>
                {
                    console.log("FacebookLogin.login authdata: ",  authdata);

                    getFacebookUserDataAndAuth(authdata).then((session:AuthSession) => 
                    {
                        resolve(session);
                    })
                    .catch(error => 
                    {		
                        reject("LOGIN_ERROR");
                    });
                })
                .catch(error => 
                {
                    console.log('Error logging into Facebook', error);

                    //message: "SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]:

                    reject("LOGIN_ERROR");
                });
});

Expected behavior
It should resolve the request with the auth data.

Screenshots
image

Smartphone (please complete the following information):

  • Device: OnePlus5T
  • OS: Android 10
  • Browser Capacitor + WebView latest version

E/GraphResponse Error validating access token: The session has been invalidated because the user changed their password or Facebook has changed the session for security reasons

Hi Folks!! I´m trying to implement this Facebook Login in my Ionic Capacitor APP.

Describe the bug

const result = await FacebookLogin.login(['email']);

But i have nothing in the response, and it return false : if (result.accessToken) {

Some Important points:

MainActivity.java Was changed and added : add(jp.rdlabo.capacitor.plugin.facebook.FacebookLogin.class);

AndroidManifest.xml was changed

Using:
"@angular/common": "~11.2.13",
"@angular/core": "~11.2.13",
"@angular/fire": "^6.1.4",
"@angular/forms": "~11.2.13",
"@angular/platform-browser": "~11.2.13",
"@angular/platform-browser-dynamic": "~11.2.13",
"@angular/router": "~11.2.13",
"@capacitor/android": "^2.4.3",
"@capacitor/core": "2.4.3",
"@ionic-native/core": "^5.32.1",
"@ionic-native/facebook": "^5.32.1",
"@ionic-native/push": "^5.32.1",
"@ionic-native/splash-screen": "^5.32.1",
"@ionic-native/status-bar": "^5.32.1",
"@ionic/angular": "^5.6.6",
"@rdlabo/capacitor-facebook-login": "^2.0.3",
"async-mutex": "^0.2.6",
"cordova-plugin-facebook4": "^6.4.0",
"es6-promise-plugin": "^4.2.2",
"firebase": "^8.1.1",
"globalthis": "^1.0.2",
"ionic-rating": "^2.0.0",
"phonegap-plugin-multidex": "^1.0.0",
"rxjs": "~6.5.5",
"tslib": "^2.2.0",
"zone.js": "~0.10.3"
I Just added the code:

And then the Run Result:

V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 93895678, pluginId: FacebookLogin, methodName: login
V/Capacitor: callback: 93895678, pluginId: FacebookLogin, methodName: login, methodData: {}
D/Capacitor/FacebookLogin: Entering login()
D/InputMethodManager: HSIFW - flag : 0 Pid : 26055
V/FA: Recording user engagement, ms: 67747
V/FA: Connecting to remote service
W/com.facebook.appevents.AppEventsLoggerImpl: This function is deprecated. deactivate app will be logged automatically
D/Capacitor: App paused
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@d543416
V/FA: onActivityCreated
V/FA: Activity paused, time: 1990637269
D/PhoneWindow: forceLight changed to true [] from com.android.internal.policy.PhoneWindow.updateForceLightNavigationBar:4238 com.android.internal.policy.DecorView.updateColorViews:1491 com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged:3216 android.view.Window.setFlags:1148 com.android.internal.policy.PhoneWindow.generateLayout:2444
I/MultiWindowDecorSupport: updateCaptionType >> DecorView@32a9c8f[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
D/MultiWindowDecorSupport: setCaptionType = 0, DecorView = DecorView@32a9c8f[]
V/FA: Connection attempt already in progress
V/FA: Activity resumed, time: 1990637346
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/ViewRootImpl@b554729[FacebookActivity]: setView = com.android.internal.policy.DecorView@32a9c8f TM=true MM=false
D/ViewRootImpl@903e594[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@2638045[MainActivity]
getNavigationBarColor() -855310
D/ViewRootImpl@b554729[FacebookActivity]: Relayout returned: old=(0,0,720,1560) new=(0,0,720,1560) req=(720,1560)0 dur=16 res=0x7 s={true 513239728128} ch=true
D/OpenGLRenderer: createReliableSurface : 0x76e3de0e80, 0x777f78c000
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/ViewRootImpl@b554729[FacebookActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@32a9c8f[FacebookActivity]
getNavigationBarColor() -855310
D/InputMethodManager: prepareNavigationBarInfo() DecorView@32a9c8f[FacebookActivity]
getNavigationBarColor() -855310
V/InputMethodManager: Starting input: tba=com.marceloj.open7 ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel destroyed: 'ClientS', fd=176
D/ViewRootImpl@b554729[FacebookActivity]: MSG_RESIZED: frame=(0,0,720,1560) ci=(0,53,0,84) vi=(0,53,0,84) or=1
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 4
V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 926
V/FA: Activity paused, time: 1990638276
D/ViewRootImpl@b554729[FacebookActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@32a9c8f[FacebookActivity]
getNavigationBarColor() -855310
D/InputTransport: Input channel destroyed: 'ClientS', fd=171
D/FA: Application going to the background
V/FA: Inactivity, disconnecting from the service
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
D/ViewRootImpl@b554729[FacebookActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@32a9c8f[FacebookActivity]
getNavigationBarColor() -855310
D/InputMethodManager: prepareNavigationBarInfo() DecorView@32a9c8f[FacebookActivity]
getNavigationBarColor() -855310
V/InputMethodManager: Starting input: tba=com.marceloj.open7 ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/Capacitor/FacebookLogin: Entering handleOnActivityResult(64206, -1)
D/Capacitor/FacebookLogin: LoginManager.onCancel
onActivityResult succeeded
D/ViewRootImpl@903e594[MainActivity]: stopped(false) old=false
D/Capacitor/App: Firing change: true
V/Capacitor/App: Notifying listeners for event appStateChange
V/FA: Activity resumed, time: 1990652784
D/Capacitor/App: No listeners found for event appStateChange
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
(HTTPLog)-Static: isSBSettingEnabled false
D/Capacitor: App resumed
D/ViewRootImpl@903e594[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@2638045[MainActivity]
getNavigationBarColor() -855310
D/InputMethodManager: prepareNavigationBarInfo() DecorView@2638045[MainActivity]
getNavigationBarColor() -855310
V/InputMethodManager: Starting input: tba=com.marceloj.open7 ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel destroyed: 'ClientS', fd=171
D/ViewRootImpl@b554729[FacebookActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@32a9c8f[FacebookActivity]
D/InputMethodManager: getNavigationBarColor() -855310
V/Capacitor/Network: Notifying listeners for event networkStatusChange
D/Capacitor/Network: No listeners found for event networkStatusChange
I/Capacitor/Console: File: http://localhost/pages-login-login-module-es2015.js - Line 149 - Msg: Rodou Facebook 2
I/Capacitor/Console: File: http://localhost/pages-login-login-module-es2015.js - Line 153 - Msg: Acima o conteúdo do result
I/Capacitor/Console: File: http://localhost/pages-login-login-module-es2015.js - Line 184 - Msg: Response não trouxe nada...
File: http://localhost/pages-login-login-module-es2015.js - Line 186 - Msg: Finalizando Facebook 2
I/Capacitor/Console: File: http://localhost/pages-login-login-module-es2015.js - Line 438 - Msg: LoginPage: loginUsingFacebook Sucesso no Login
E/GraphResponse: {HttpStatus: 400, errorCode: 190, subErrorCode: 460, errorType: OAuthException, errorMessage: Error validating access token: The session has been invalidated because the user changed their password or Facebook has changed the session for security reasons.}
I/Capacitor/Console: File: http://localhost/pages-login-login-module-es2015.js - Line 439 - Msg: undefined
D/ViewRootImpl@b554729[FacebookActivity]: stopped(true) old=false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
(HTTPLog)-Static: isSBSettingEnabled false
W/libEGL: EGLNativeWindowType 0x76e3de0e90 disconnect failed
D/ViewRootImpl@b554729[FacebookActivity]: dispatchDetachedFromWindow
D/InputTransport: Input channel destroyed: 'a762e93', fd=162
V/FA: Connecting to remote service
V/FA: Connection attempt already in progress
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 2
E/GraphResponse: {HttpStatus: 400, errorCode: 190, subErrorCode: 460, errorType: OAuthException, errorMessage: Error validating access token: The session has been invalidated because the user changed their password or Facebook has changed the session for security reasons.}
V/FA: Inactivity, disconnecting from the service
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
E/GraphResponse: {HttpStatus: 400, errorCode: 190, subErrorCode: 460, errorType: OAuthException, errorMessage: Error validating access token: The session has been invalidated because the user changed their password or Facebook has changed the session for security reasons.}
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
(HTTPLog)-Static: isSBSettingEnabled false
E/GraphResponse: {HttpStatus: 400, errorCode: 190, subErrorCode: 460, errorType: OAuthException, errorMessage: Error validating access token: The session has been invalidated because the user changed their password or Facebook has changed the session for security reasons.}

Could you Help me?

FB is not define web.js

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

FB is not defined - Plugin is using Web while testing on Android.

Describe the bug
Receving "ReferenceError: FB is not defined" - it also appears to try using the Web.js one, trying to open an tab on browser - I'm testing on Android.
When I remove the web configuration, the following error occurs:

Error log
FacebookLoginWeb.login {permissions: Array(1)}permissions: ['email'][[Prototype]]: Object
login_social.js:38 ReferenceError: FB is not defined
at web.js:22
at new Promise ()
at FacebookLoginWeb. (web.js:21)
at Generator.next ()
at web.js:7
at new Promise ()
at __awaiter (web.js:3)
at FacebookLoginWeb.login (web.js:19)
at Object.login_social.facebook (login_social.js:17)

Smartphone (please complete the following information):

  • Device: Xiaomi Mi 8 Lite
  • OS: 11

Additional context
I've upgraded to Capacitor 3 from 2, and then upgraded the plugin to the latest version.

Migration to v3 doc.

Describe the bug
AppDelegate.swift:3:8: error: no such module 'FacebookCore'

To Reproduce
I did migrated from old version to 3 and was not able to compile my app

Expected behavior
Maybe it make sense to add into docs information that during upgrade to make sure that we import
import FBSDKCoreKit
Instead of
import FacebookCore

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.