requestHint method
Opens dialog of user emails and/or phone numbers More about hint request https://developers.google.com/identity/smartlock-passwords/android/retrieve-hints More about parameters https://developers.google.com/android/reference/com/google/android/gms/auth/api/credentials/HintRequest.Builder
Implementation
Future<Credential?> requestHint({
// Enables returning credential hints where the identifier is an email address,
// intended for use with a password chosen by the user.
bool? isEmailAddressIdentifierSupported,
// Enables returning credential hints where the identifier is a phone number,
// intended for use with a password chosen by the user or SMS verification.
bool? isPhoneNumberIdentifierSupported,
// The list of account types (identity providers) supported by the app.
// typically in the form of the associated login domain for each identity provider.
String? accountTypes,
// Enables button to add account
bool? showAddAccountButton,
// Enables button to cancel request
bool? showCancelButton,
// Specify whether an ID token should be acquired for hints, if available for the selected credential identifier.This is enabled by default;
// disable this if your app does not use ID tokens as part of authentication to decrease latency in retrieving credentials and credential hints.
bool? isIdTokenRequested,
// Specify a nonce value that should be included in any generated ID token for this request.
String? idTokenNonce,
//Specify the server client ID for the backend associated with this app.
// If a Google ID token can be generated for a retrieved credential or hint,
// and the specified server client ID is correctly configured to be associated with the app,
// then it will be used as the audience of the generated token. If a null value is specified,
// the default audience will be used for the generated ID token.
String? serverClientId,
}) async {
if (_isAndroid(Methods.requestHint)) {
try {
final res = await _channel.invokeMethod(Methods.requestHint, {
'isEmailAddressIdentifierSupported':
isEmailAddressIdentifierSupported,
'isPhoneNumberIdentifierSupported': isPhoneNumberIdentifierSupported,
'accountTypes': accountTypes,
'isIdTokenRequested': isIdTokenRequested,
'showAddAccountButton': showAddAccountButton,
'showCancelButton': showCancelButton,
'idTokenNonce': idTokenNonce,
'serverClientId': serverClientId,
});
if (res == null) return null;
final Map<String, dynamic> map =
jsonDecode(jsonEncode(res)) as Map<String, dynamic>;
return Credential.fromJson(map);
} catch (error) {
debugPrint('Pinput/SmartAuth: requestHint failed: $error');
return null;
}
}
return null;
}