GithubAuthProvider class
This class should be used to either create a new GitHub 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
):
GithubAuthProvider githubProvider = GithubAuthProvider();
githubProvider.addScope('repo');
githubProvider.setCustomParameters({
'allow_signup': 'false',
});
FirebaseAuth.instance.signInWithPopup(githubProvider)
.then(...);
If authenticating with GitHub 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
GithubAuthCredential githubAuthCredential = GithubAuthProvider.credential(accessToken);
FirebaseAuth.instance.signInWithCredential(githubAuthCredential)
.then(...);
- Inheritance
-
- Object
- AuthProvider
- OAuthProvider
- GithubAuthProvider
Constructors
- GithubAuthProvider()
- Creates a new instance.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- parameters → Map?
-
Returns the parameters for this provider instance.
This is a Web only API.
no setterinherited
- 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.
This is a Web only API.
no setterinherited
Methods
-
addScope(
String scope) → OAuthProvider -
Adds OAuth scope.
This is a Web only API.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCustomParameters(
Map customOAuthParameters) → OAuthProvider -
Sets the OAuth custom parameters to pass in a OAuth request for popup and
redirect sign-in operations.
This is a Web only API.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
credential(
String accessToken) → OAuthCredential -
Create a new GithubAuthCredential from a provided
accessToken
;override
Constants
- GITHUB_SIGN_IN_METHOD → const String
- githubSignInMethod → const String
- This corresponds to the sign-in method identifier.
- id → const String
- PROVIDER_ID → const String