Closed Lanticee closed 5 months ago
Your code works but it doesn't ensure that the login with Facebook was succesful please use a code like this
import 'package:firebase_auth/firebase_auth.dart';
.
.
.
Future<UserCredential?> signInWithFacebook() async {
final LoginResult result = await FacebookAuth.instance.login();
if(result.status == LoginStatus.success){
// Create a credential from the access token
final OAuthCredential credential = FacebookAuthProvider.credential(result.accessToken!.token);
// Once signed in, return the UserCredential
return await FirebaseAuth.instance.signInWithCredential(credential);
}
print(result.status);
print(result.message)
return null;
}
Check in your console if you are getting some error
I make one sample project here https://github.com/Lanticee/testfb
I do not use firebase... I just need facebook token
Have you followed this https://facebook.meedu.app/docs/5.x.x/macos ?
yes. i followed. and it work yestoday, after update macos or flutter today, it not work any more
I tried use await FacebookAuth.getInstance().accessToken!; it make macos app crash.
I try this FirebaseAuth auth = FirebaseAuth.instance;
User? user = FirebaseAuth.instance.currentUser;
app get crash too.
@Lanticee sorry but I am not able to reproduce the issue even using your example repo. Login with macOs was successful. The Only thing I do was add the KeySharing capability without any group and it works.
Also you can try the last version of this plugin to check if the error persists
tested on
macOS (desktop) • macos • darwin-arm64 • macOS 14.1.1 23B81
I tried sample project again.
I added key sharing flutter_secure_storage
FacebookAuth.instance.accessToken .then((value) => debugPrint(value!.token));
2023-11-18 09:19:25.930 testfb[4253:34726] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
56)
The error says that you are using ! on a null value witch is right of there is not an active session. That doesn't tell us what is the problem. Try running the example project of this repo and tell me if the error persists
yes, FacebookAuth.instance is not work now.
2023-11-18 09:34:09.591 testfb[5334:51532] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit
by using await FacebookAuth.instance.getUserData(); then I got
Process: testfb [5334] Path: /Users/USER/Documents/*/testfb.app/Contents/MacOS/testfb Identifier: com.example.fb.login.testfb Version: 1.0.0 (1) Code Type: ARM-64 (Native) Parent Process: dart [4929] Responsible: studio [4810] User ID: 501
Date/Time: 2023-11-18 09:44:51.1504 +0800 OS Version: macOS 14.1.1 (23B81) Report Version: 12 Anonymous UUID: ED2F041D-BB77-84E6-5375-644CE9FF8699
Time Awake Since Boot: 3000 seconds
System Integrity Protection: enabled
Notes: Extracting libpas PGM metadata failed.
Crashed Thread: 1 io.flutter.ui
Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000118f08f48 Exception Codes: 0x0000000000000002, 0x0000000118f08f48
Termination Reason: Namespace SIGNAL, Code 10 Bus error: 10 Terminating Process: exc handler [5334]
VM Region Info: 0x118f08f48 is in 0x118f00000-0x118f80000; bytes after start: 36680 bytes before end: 487607
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
VM_ALLOCATE 118efc000-118f00000 [ 16K] r--/r-- SM=PRV
---> VM_ALLOCATE 118f00000-118f80000 [ 512K] r--/rwx SM=PRV
VM_ALLOCATE 118f80000-119000000 [ 512K] r-x/rwx SM=PRV
Error Formulating Crash Report: Extracting libpas PGM metadata failed.
yes, FacebookAuth.instance is not work now.
2023-11-18 09:34:09.591 testfb[5334:51532] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit
by using await FacebookAuth.instance.getUserData();
then I got
Translated Report (Full Report Below)
Process: testfb [5334]
Path: /Users/USER/Documents/*/testfb.app/Contents/MacOS/testfb
Identifier: com.example.fb.login.testfb
Version: 1.0.0 (1)
Code Type: ARM-64 (Native)
Parent Process: dart [4929]
Responsible: studio [4810]
User ID: 501
Date/Time: 2023-11-18 09:44:51.1504 +0800
OS Version: macOS 14.1.1 (23B81)
Report Version: 12
Anonymous UUID: ED2F041D-BB77-84E6-5375-644CE9FF8699
Time Awake Since Boot: 3000 seconds
System Integrity Protection: enabled
Notes:
Extracting libpas PGM metadata failed.
Crashed Thread: 1 io.flutter.ui
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000118f08f48
Exception Codes: 0x0000000000000002, 0x0000000118f08f48
Termination Reason: Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process: exc handler [5334]
VM Region Info: 0x118f08f48 is in 0x118f00000-0x118f80000; bytes after start: 36680 bytes before end: 487607
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL VM_ALLOCATE 118efc000-118f00000 [ 16K] r--/r-- SM=PRV
---> VM_ALLOCATE 118f00000-118f80000 [ 512K] r--/rwx SM=PRV
VM_ALLOCATE 118f80000-119000000 [ 512K] r-x/rwx SM=PRV
Error Formulating Crash Report:
Extracting libpas PGM metadata failed.
sorry but you don't provide the enough info about the problem. Plase be more clear. Also try with the example project of this plugin to check a right way to use this plugin
sorry, I tried to find more information, but I still do very less things. I change sample project, and found FaceBookAuth.instance.accessToken null after FacebookAuth.instance.login. I still can get accessToken from loginResult or facebookAuthCredential , just found FacebookAuth.instance.accessToken not work anymore. thx.
sorry, I tried to find more information, but I still do very less things.
I change sample project, and found FaceBookAuth.instance.accessToken null after FacebookAuth.instance.login.
I still can get accessToken from loginResult or facebookAuthCredential , just found FacebookAuth.instance.accessToken not work anymore.
thx.
Try with the lastest vesion 6.0.3
flutter_facebook_auth: 6.0.3
flutter: fb instance in login: null
it seems like same problem.
is it my environment get wrong?
flutter_facebook_auth: 6.0.3
flutter: fb instance in login: null
it seems like same problem.
is it my environment get wrong?
Please try with the example project inside this repo. As I said I have runned your example without any problem. I just removed the firebase auth and the groups inside the keychain capabilty due to I Just want to test the Facebook login. Also I noticed that in your login you have custom persmission keep in mind that all that permission must be enabled and authorized into your Facebook console
hi i remove some permissions. left permissions: const ["public_profile", "email","publish_video"],
it works now.
'pages_read_engagement', 'pages_manage_posts' make it run wrong. thx a lot
What version are you using?
6.0.2
What OS and version are you using to local deploy your application?
macos 14.1.1
What platforms are you seeing the problem on?
macOS
pubspec.yaml
Describe the Bug
Login to Facebook is sucess, and get return correct, but at 14.1.1 ,FacebookAuth.instance.accessToken get null, it works at macos before version.
Expected Behavior
FacebookAuth.instance.accessToken work before, if i need get information.
To Reproduce
I just follow Future signInWithFacebook() async {
// Trigger the sign-in flow
final LoginResult loginResult = await FacebookAuth.instance.login();
// Create a credential from the access token final OAuthCredential facebookAuthCredential = FacebookAuthProvider.credential(loginResult.accessToken.token);
// Once signed in, return the UserCredential return FirebaseAuth.instance.signInWithCredential(facebookAuthCredential); }
then FacebookAuth.instance.accessToken to get information to check expires
Relevant log output
No response
flutter doctor -v
Info.plist (iOS)
No response
Podfile (iOS)
No response
AndroidManifest.xml
No response
MainActivity.java
No response
MainActivity.kt
No response
index.html
No response
Info.plist (macOS)
No response