flutter_facebook_auth 5.0.0 flutter_facebook_auth: ^5.0.0 copied to clipboard
The easiest way to add facebook login to your flutter app. Feature includes getting user information, profile picture and more. This plugin also supports Web.
Features #
- Login on Android, iOS, Web and macOS.
- Express login on Android.
- Granted and declined permissions.
- User information, picture profile and more.
- Provide an access token to make request to the Graph API.
Full documentation 👉 https://facebook.meedu.app
✅ Don't forget to leave your like if this plugin was useful for you.
IMPORTANT: When you install this plugin you need to configure the plugin on Android before run the project again . If you don't do it you will have a No implementation found error because the facebook SDK on Android throws an Exception when the configuration is not defined yet and this locks the other plugins in your project. If you don't need the plugin yet please remove or comment it.
macOS support #
in your macos/runner/info.plist
folder you must add
<key>com.apple.security.network.server</key>
<true/>
Now in xcode
select the Runner
target and go to Signing & Capabilities and enable
Outgoing Connections
Unlinke ios, android and web for desktop app the facebook session data is not stored by default. In that case this plugin uses flutter_secure_storage
to
secure store the session data.
To use flutter_secure_storage
on macOS you need to add the Keychain Sharing
capability
Finally in your main.dart
you need to initialize this plugin to be available for macOS
import 'package:flutter/foundation.dart' show defaultTargetPlatform;
void main() async {
if (defaultTargetPlatform == TargetPlatform.macOS) {
await FacebookAuth.i.webAndDesktopInitialize(
appId: "1329834907365798",
cookie: true,
xfbml: true,
version: "v13.0",
);
}
runApp(MyApp());
}
If your app also support web you must use the next code instead of above code
import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb;
void main() async {
if (kIsWeb || defaultTargetPlatform == TargetPlatform.macOS) {
await FacebookAuth.i.webAndDesktopInitialize(
appId: "1329834907365798",
cookie: true,
xfbml: true,
version: "v13.0",
);
}
runApp(MyApp());
}