Back

Currently is it possible to use native google & apple singing on flutter client ?

  • 0
  • Flutter
Hitesh_TechHiyo
19 Dec, 2023, 08:52

i want to do somthing like this

Future<dynamic?> signInWithGoogle() async { const webClientId = Google_auth_webClientId; const iosClientId = Google_auth_iosClientId; final GoogleSignIn googleSignIn = GoogleSignIn( clientId: iosClientId, serverClientId: webClientId, ); final googleUser = await googleSignIn.signIn(); final googleAuth = await googleUser!.authentication; final accessToken = googleAuth.accessToken; final idToken = googleAuth.idToken;

TypeScript
if (accessToken == null) {
  throw 'No Access Token found.';
}
if (idToken == null) {
  throw 'No ID Token found.';
}

return _account.createOAuth2Session(

   provider: 'google',
      accessToken: "",
      oauthToken: "",


  // provider: OAuthProvider.google,
  // idToken: idToken,
  // accessToken: accessToken,
);
TL;DR
The user is asking if it is possible to use native Google and Apple sign-in on a Flutter client. They provide code examples using the Appwrite and GoogleSignIn packages. The AI assistant suggests using the Appwrite documentation and a Flutter SDK quick start guide for reference. The user also shares their own code for signing in with Google. No solution is provided in the thread.
Hitesh_TechHiyo
19 Dec, 2023, 08:52

Currently is it possible to use native google & apple singing on flutter client ?

Haimantika
19 Dec, 2023, 10:12

Have you tried using the Flutter SDK?

Haimantika
19 Dec, 2023, 10:13

Here's a quickstart on creating a login page with Flutter SDK. See if you can take reference from here and use Google/Apple sign in πŸ™‚

Haimantika
19 Dec, 2023, 10:14

Btw, I just used Appwrite AI assistant for your query, and this is what it returned. Try and let me know. πŸ‘€

Haimantika
19 Dec, 2023, 10:15
TypeScript
import 'package:appwrite/appwrite.dart';

// Initialize the Appwrite client
Client client = Client();
client.setEndpoint('https://[HOSTNAME_OR_IP]/v1'); // Replace [HOSTNAME_OR_IP] with your Appwrite endpoint
client.setProject('[PROJECT_ID]'); // Replace [PROJECT_ID] with your Appwrite project ID

// Initialize the Google sign-in provider
GoogleProvider googleProvider = GoogleProvider(client);

// Sign in with Google
try {
  await googleProvider.signIn();
  // Handle the successful sign-in
} catch (e) {
  // Handle any errors
}
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more