FacebookAuthProvider class
This class should be used to either create a new Facebook credential with an access code, or use the provider to trigger user authentication flows.
For example, on web based platforms pass the provider to a Firebase method
(such as signInWithPopup
):
var facebookProvider = FacebookAuthProvider();
facebookProvider.addScope('user_birthday');
facebookProvider.setCustomParameters({
'display': 'popup',
});
FirebaseAuth.instance.signInWithPopup(facebookProvider)
.then(...);
If authenticating with Facebook via a 3rd party, use the returned
accessToken
to sign-in or link the user with the created credential,
for example:
String accessToken = '...'; // From 3rd party provider
var facebookAuthCredential = FacebookAuthProvider.credential(accessToken);
FirebaseAuth.instance.signInWithCredential(facebookAuthCredential)
.then(...);
- Inheritance
-
- Object
- AuthProvider
- FacebookAuthProvider
Constructors
- FacebookAuthProvider()
- Creates a new instance.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- parameters → Map
-
Returns the parameters for this provider instance.
no setter
- providerId → String
-
The provider ID.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scopes
→ List<
String> -
Returns the currently assigned scopes to this provider instance.
no setter
Methods
-
addScope(
String scope) → FacebookAuthProvider - Adds Facebook OAuth scope.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCustomParameters(
Map customOAuthParameters) → FacebookAuthProvider - Sets the OAuth custom parameters to pass in a Facebook OAuth request for popup and redirect sign-in operations.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- FACEBOOK_SIGN_IN_METHOD → String
-
This corresponds to the sign-in method identifier.
no setter
- PROVIDER_ID → String
-
no setter
Static Methods
-
credential(
String accessToken) → OAuthCredential -
Create a new FacebookAuthCredential from a provided
accessToken
;