dartway_auth_google 0.1.0 copy "dartway_auth_google: ^0.1.0" to clipboard
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.

0
likes
150
points
341
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

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.

Homepage
Repository (GitHub)
View/report issues

Topics

#dartway #authentication #google #sign-in #flutter

License

Apache-2.0 (license)

Dependencies

crypto, dartway_auth_providers_shared, dartway_core_flutter, flutter, google_sign_in

More

Packages that depend on dartway_auth_google