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;
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,
);
Currently is it possible to use native google & apple singing on flutter client ?
Have you tried using the Flutter SDK?
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 🙂
Btw, I just used Appwrite AI assistant for your query, and this is what it returned. Try and let me know. 👀
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
}
Recommended threads
- CORS error only on tables db api After u...
I've recently updated my self hosted appwrite instance to the 1.8.0 and updated my frontend with the tables db apis but strangely, even if I'm able to log in, g...
- [SOLVED] Access ExecutionStatus of a fun...
I am calling a cloud function from the newest Flutter SDK 20.2.1with the `xasync: false` flag and get the result, but the `execution.status` is not a String and...
- Appwrite isn't accepting the api from se...
Error creating user: AppwriteException: Server Error type: 'general_unknown', response: '{"message":"Server Error","code":500,"type":"general_unknown","versi...