For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.
Allows you to perform native Google, Apple, and Facebook sign in by combining it with google_sign_in, sign_in_with_apple, or flutter_facebook_auth packages.
The provider to perform the sign in with.
The identity token obtained from the third-party provider.
Access token obtained from the third-party provider. Required for Google sign in.
Raw nonce value used to perform the third-party sign in. Required for Apple sign-in.
The captcha token to be used for captcha verification.
import 'package:google_sign_in/google_sign_in.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
const webClientId = '<web client ID that you registered on Google Cloud, for example my-web.apps.googleusercontent.com>';
const iosClientId = '<iOS client ID that you registered on Google Cloud, for example my-ios.apps.googleusercontent.com';
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.';
}
final response = await supabase.auth.signInWithIdToken(
provider: OAuthProvider.google,
idToken: idToken,
accessToken: accessToken,
);
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:crypto/crypto.dart';
/// Performs Apple sign in on iOS or macOS
final rawNonce = supabase.auth.generateRawNonce();
final hashedNonce = sha256.convert(utf8.encode(rawNonce)).toString();
final credential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
nonce: hashedNonce,
);
final idToken = credential.identityToken;
if (idToken == null) {
throw const AuthException(
'Could not find ID Token from generated credential.',
);
}
final response = await supabase.auth.signInWithIdToken(
provider: OAuthProvider.apple,
idToken: idToken,
nonce: rawNonce,
);
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
Future<void> signInWithFacebook() async {
final LoginResult result = await FacebookAuth.instance.login(
permissions: ['public_profile', 'email'],
);
if (result.status == LoginStatus.success) {
final accessToken = result.accessToken!.tokenString;
final response = await supabase.auth.signInWithIdToken(
provider: OAuthProvider.facebook,
idToken: accessToken,
);
} else {
throw const AuthException(
'Facebook login failed: ${result.status}',
);
}
}