dartway_auth_google 0.1.0
dartway_auth_google: ^0.1.0 copied to clipboard
Sign in with Google for a DartWay app, reached as dw.signInWithGoogle(): the SDK initialised with a nonce the server checks, and the ID token sent as the sign-in command.
dartway_auth_google #
Sign in with Google for a DartWay app: dw.signInWithGoogle().
// in main, once, before the first sign-in
await DwGoogleAuth.initialize(
clientId: iosClientId, // where the platform needs one in code
serverClientId: webClientId, // what Android needs to mint an ID token at all
);
final result = await dw.signInWithGoogle(
introduce: (account) => {
if (account.displayName case final name?) RegistrationKeys.firstName: name,
},
);
The Google SDK takes its nonce at initialisation, not per sign-in, so DwGoogleAuth.initialize makes
one and remembers it; the server checks it against the token. Both client ids must be among the ones
the server is configured with — Android, iOS and the web each have their own, and a token issued for
one the server does not know is refused.
The server half is dartway_auth_providers_server. Documentation:
docs/4-server/auth-identity.md.