google_one_tap_sign_in

Creator: coderz1093

Last updated:

Add to Cart

Description:

google one tap sign in

Google One Tap Sign In #
Google One Tap Sign In (Android)
A Flutter Plugin for Google One Tap Sign In
Getting Started #
To access Google Sign-In, you'll need to make sure to register your application.


Add to your pubspec.yaml
dependencies:
google_one_tap_sign_in: [any]
copied to clipboard


Add Google Service
classpath 'com.google.gms:google-services:[x.x.x]'
copied to clipboard


Import plugin
import 'package:google_one_tap_sign_in/google_one_tap_sign_in.dart';
copied to clipboard


Handle Simple Method
// Your Web Client Id
final String _webClientId = "[XXXXXXXXXXX]";
void _onSignIn() async {
var data = await GoogleOneTapSignIn.startSignIn(webClientId: _webClientId);
if (data != null) {
// Whatever you do with [SignInResult] data
print("Id Token : ${data.idToken ?? "-"}");
print("ID : ${data.id ?? "-"}");
}
}
copied to clipboard


Handle with Condition Method
// Your Web Client Id
final String _webClientId = "[XXXXXXXXXXX]";
void _onSignInWithHandle() async {
var result = await GoogleOneTapSignIn.handleSignIn(webClientId: _webClientId);

if (result.isTemporaryBlock) {
// TODO: Tell your users about this status
print("Temporary BLOCK");
}

if (result.isCanceled) {
// TODO: Tell your users about this status
print("Canceled");
}

if (result.isFail) {
// TODO: Tell your users about this status
}

if (result.isOk) {
// TODO: Whatever you do with [SignInResult] data
print("OK");
print("Id Token : ${result.data?.idToken ?? "-"}");
print("Email : ${result.data?.username ?? "-"}");
}
}
copied to clipboard


Example #
Find the example wiring in the Google One Tap Sign In

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.