FlutterflowDevs
ย ยทย FlutterFlow App Development Agency

SupaBase Anonymous Login

Supabase Anonymous Login allows users to access your app without creating an account or providing credentials, making it ideal for guest browsing or quick onboarding. It enhances user experience by reducing friction during the onboarding process while maintaining security and scalability. Users can later upgrade an anonymous session to a fully registered account without losing data.

Prerequisites

  • Supabase: An open-source Backend-as-a-Service platform, often seen as an alternative to Firebase, known for its focus on open-source technologies and relational databases like PostgreSQL.

  • FlutterFlow: A low-code development platform built on Flutter for creating mobile, web, and desktop applications from a single codebase.

Setting Up Supabase

  1. Create a Supabase Project: Sign in at Supabase, create a new project, and set up a secure database password.

  2. Configure API Keys: Go to Project Settings > API and copy the Project URL and anon public key for client-side configuration.

  3. Enable Anonymous Sign-Ins: In Project Settings > Authentication, enable Anonymous Sign-Ins under the User Signups section.

Integrating with FlutterFlow

  1. Create a FlutterFlow Project: Set up a new project on the FlutterFlow console.

  2. Enable Supabase Authentication: In the settings, enable authentication and select Supabase as the authentication type. Use the API URL and Anon Key from Supabase.

  3. Implementing Anonymous Login: Create an Auth Page with a Guest Sign In button that triggers the following custom action:

Future anonymousLogin(BuildContext context) async {

final supabase = Supabase.instance.client;

try {

final response = await supabase.auth.signInAnonymously();

if (response.user != null)

{

print("Signed in as anonymous user: ${response.user!.id}");

context.goNamedAuth('HomePage', context.mounted);

}

} catch (error) {

print("Error signing in anonymously: $error");

}

}

When successfully signed in, the user navigates to a designated page using context.goNamedAuth().

Conclusion

Supabase Anonymous Login enhances user onboarding by allowing guest access without account creation. Integrated with FlutterFlow, it ensures seamless authentication while maintaining security and scalability. This approach allows users to later upgrade to a registered account without losing data, improving engagement and flexibility.

For more details, please check the below link.
https://www.flutterflowdevs.com/blog/supabase-anonymous-login

3
3 replies