TwitterAuthProvider class
This class should be used to either create a new Twitter 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 twitterProvider = TwitterAuthProvider();
twitterProvider.setCustomParameters({
'lang': 'es'
});
FirebaseAuth.instance.signInWithPopup(twitterProvider)
.then(...);
If authenticating with Twitter 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
String secret = '...'; // From 3rd party provider
var twitterAuthCredential = TwitterAuthCredential.credential(accessToken: accessToken, secret: secret);
FirebaseAuth.instance.signInWithCredential(twitterAuthCredential)
.then(...);
- Inheritance
-
- Object
- AuthProvider
- TwitterAuthProvider
Constructors
- TwitterAuthProvider()
- Creates a new instance.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
parameters
→ Map<
String, String> -
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
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCustomParameters(
Map< String, String> customOAuthParameters) → TwitterAuthProvider - Sets the OAuth custom parameters to pass in a Twitter 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
- PROVIDER_ID → String
-
no setter
- TWITTER_SIGN_IN_METHOD → String
-
This corresponds to the sign-in method identifier.
no setter
Static Methods
-
credential(
{required String accessToken, required String secret}) → OAuthCredential -
Create a new TwitterAuthCredential from a provided
accessToken
andsecret
;