Mission-Critical Authentication
Afribase Auth provides a hardened, enterprise-grade authentication solution built on the industry-standard **GoTrue** API. Deploy secure social login, magic links, and multi-factor authentication across your entire organization with zero infrastructure management.
Identity Providers
Email & Magic Links
Standard password-based login or secure, passwordless magic links delivered via email.
OAuth Providers
Instantly enable social login with Google, GitHub, Slack, Discord, and dozens of others.
WebAuthn (Passkeys)
Coming soon. Modern, biometric-based passwordless authentication methods.
Implementation
Afribase provides a strongly-typed interface for managing authentication. Below are the core methods available in our SDKs (JavaScript, Python, Dart).
Sign Up / Sign In
JavaScript
// Sign Up
const { data, error } = await afribase.auth.signUp({
email: 'user@example.com',
password: 'securePassword123'
});
// Sign In with Password
const { data, error } = await afribase.auth.signInWithPassword({
email: 'user@example.com',
password: 'securePassword123'
});Python
# Sign Up
client.auth.sign_up(email="user@example.com", password="securePassword123")
# Sign In with Password
client.auth.sign_in_with_password(email="user@example.com", password="securePassword123")Dart / Flutter
// Sign Up
await client.auth.signUp(email: 'user@example.com', password: 'securePassword123');
// Sign In with Password
await client.auth.signInWithPassword(email: 'user@example.com', password: 'securePassword123');Passwordless & OAuth
JavaScript
// Send OTP / Magic Link
await afribase.auth.signInWithOtp({ email: 'user@example.com' });
// Social Login
const { url } = await afribase.auth.signInWithOAuth({ provider: 'google' });Python
# Send OTP / Magic Link
client.auth.sign_in_with_otp(email="user@example.com")
# Social Login
url = client.auth.sign_in_with_oauth(provider="google")Dart / Flutter
// Send OTP / Magic Link
await client.auth.signInWithOtp(email: 'user@example.com');
// Social Login
final url = await client.auth.signInWithOAuth(provider: 'google');Session Management
JavaScript
afribase.auth.onAuthStateChange((event, session) => {
console.log('Auth Event:', event); // 'SIGNED_IN', 'SIGNED_OUT'
});Python
def on_auth_change(event, session):
print(f"Auth state changed: {event}")
client.auth.on_auth_state_change(on_auth_change)Dart
client.auth.onAuthStateChange((event, session) => {
print('Auth state changed to: $event');
});useAuthInactivity() hook in your React applications to automatically handle session expiration and redirect users to the sign-in page.Global Policies
Organize users into **User Groups** and assign global permissions that dictate access across all services (Database, Storage, Edge Functions).
Access Control (RBAC)
Fine-grained Role Based Access Control for your entire organization.
