supabase_auth_package 0.0.2 copy "supabase_auth_package: ^0.0.2" to clipboard
supabase_auth_package: ^0.0.2 copied to clipboard

A Flutter package for Supabase authentication, supporting email/password and Google Sign-In.

πŸ“± Supabase Authentication Demo (Flutter) #

This Flutter project demonstrates the basic usage of Supabase Authentication with:

  • βœ… Email/Password Sign Up
  • βœ… Email/Password Login
  • βœ… Email Verification Check
  • βœ… Google Sign-In
  • βœ… Phone Number OTP Verification

πŸš€ Features #

  • Sign in with Google
  • Sign up & Sign in with Email/Password
  • Check if Email is Verified
  • Verify Phone Number OTP
  • Option to check for Phone Verification after Login

πŸ›  Setup Guide #

1️⃣ Prerequisites #


2️⃣ Configure Supabase #

Add the package to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  supabase_flutter: <latest version>
  google_sign_in: <latest version>
  supabase_auth_package: <latest version>

βœ… In main.dart: #

Supabase.initialize(
    url: 'your-supabase-url',
    anonKey: 'your-anon-key',
  );

βœ… Email/Password Sign-In Example #

await _authRepo.signInUsingEmailPassword(
  email: 'user@example.com',
  password: 'your-password',
  checkPhoneVerification: false,
);

βœ… Google Sign-In Example #

Future<void> _signInWithGoogle() async {
  final googleService = GoogleAuthService(
    supabaseClient: Supabase.instance.client,
    googleSignIn: GoogleSignIn(
      serverClientId: 'your-google-server-client-id', // Replace with your client ID
    ),
  );

  await googleService.signIn();
}

βœ… Email/Password Sign-Up Example #

Future<void> _signUpWithEmail() async {
  await _authRepo.signUpUsingEmailPassword(
    email: 'user@example.com',      // Replace with user email
    password: 'your-password',      // Replace with user password
  );
}

βœ… Check Email Verification Example #

Future<void> _checkEmailVerification() async {
  await _authRepo.checkEmailVerify(
    email: 'user@example.com',      // Replace with user email
    password: 'your-password',      // Replace with user password
  );
}

βœ… Verify Phone OTP Example #

Future<void> _checkOtpVerification() async {
  await _authRepo.verifyOTP(
    countryCode: '91',             // Country Code (e.g., India = 91)
    phoneNumber: '9876543210',     // User phone number without country code
    otp: '123456',                 // OTP received by user
  );
}
5
likes
130
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for Supabase authentication, supporting email/password and Google Sign-In.

Repository

Documentation

API reference

License

MIT (license)

Dependencies

flutter, google_sign_in, supabase_flutter

More

Packages that depend on supabase_auth_package