Repository navigation
Description
With the recent integration with Flutter, it would be great to allow sign in after fetching an access token by other ways. For example with plugins such as https://pub.dev/packages/google_sign_in or https://pub.dev/packages/sign_in_with_apple
Those plugins launch a native dialog depending on the platform (iOS or Android), and have ways to retrieve access tokens client side.
Parse Server has an endpoint to allow this functionality. This is a sample I did for testing such configuration with the Flutter plugins and Parse.
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: <String>[...],
);
....
// Flutter plugin related,
// Uses the plugin https://pub.dev/packages/google_sign_in
// and shows a native Google Sign In dialog.
// This could be different for an Apple sign in,
// maybe using https://pub.dev/packages/sign_in_with_apple
// which shows a native dialog as well.
final GoogleSignInAccount account = await _googleSignIn.signIn();
final GoogleSignInAuthentication auth = await account.authentication;
// Login with the backend, something similar with Appwrite would
// be great for Mobile apps
final ParseResponse response = await ParseUser.loginWith(
'google',
{
'access_token': auth.accessToken,
'id': account.id,
},
);
ParseUser _user = response.result;The tests I did were on Android with Google sign in but I would say Apple sign in would work in a similar way. These are the requirements for the above to work.
- Register an Android Client in the Google Cloud Platform Credentials dashboard.
- Provide a valid Android package name and the SHA-1 fingerprint used for signing the APK.
Some reference I followed https://medium.com/flutter-community/flutter-sign-in-with-google-in-android-without-firebase-a91b977d166f
I think such a feature would bring so much benefit for non web apps, where other ways to obtain access tokens are available, and not show a WebView if possible. I think the implementation could be generalized as in Parse, but the use cases I'm thinking for a mobile app are limited. I would say Google Sign In and Apple Sign In would be sufficient for such a feature.
Having said that, I would like to say that people are going to start asking for Apple sign in in Flutter apps, because if the app offers Google sign in, Apple will reject the app if it not includes Apple sign in as well.
Parse Server Reference and auth implementation:
https://docs.parseplatform.org/parse-server/guide/#google-authdata
https://docs.parseplatform.org/parse-server/guide/#apple-authdata
https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/google.js
https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/apple.js
Thank you, and keep up the good work!


Activity
eldadfux commentedon May 27, 2020
Sound like something very useful to allow developers max flexibility and freedom to create better UX for project users. Would love to get more community feedback on this before we start to talk about design and implementation.
eldadfux commentedon Sep 10, 2020
I'm adding this suggestion to #244 , please add any more feedback there.
frendcarlo commentedon Jul 23, 2023
hi, do we have this kind of solutions for native google and apple login? i'm currently using flutter sdk and the existing implementation provided by docs seems to be blocked by google because google now requires native popup consent.
Merge pull request appwrite#354 from utopia-php/fix/queue-release-delay
Merge pull request appwrite#354 from appwrite/t3code/fbfcf3db