{"id":1734,"library":"supabase-auth","title":"Supabase Auth Client","description":"The `supabase-auth` Python library provides a client for interacting with Supabase Auth services, enabling functionalities like user registration, login, session management, and password recovery. It's a foundational component often used directly or as part of the `supabase-py` full client library. The current version is 2.28.3, and it follows the release cadence of the broader Supabase Python ecosystem, with frequent updates.","status":"active","version":"2.28.3","language":"python","source_language":"en","source_url":"https://github.com/supabase-community/supabase-auth-py","tags":["supabase","authentication","auth","jwt","client"],"install":[{"cmd":"pip install supabase-auth","lang":"bash","label":"Install supabase-auth"}],"dependencies":[],"imports":[{"wrong":"from supabase_auth.client import AuthClient","symbol":"AsyncGoTrueClient","correct":"from supabase_auth import AsyncGoTrueClient"},{"symbol":"AsyncGoTrueAdminAPI","correct":"from supabase_auth import AsyncGoTrueAdminAPI"},{"symbol":"AuthChangeEvent","correct":"from supabase_auth import AuthChangeEvent"}],"quickstart":{"code":"import os\nfrom supabase_auth.client import AuthClient\n\n# Ensure these environment variables are set\nSUPABASE_URL = os.environ.get('SUPABASE_URL', 'YOUR_SUPABASE_URL')\nSUPABASE_ANON_KEY = os.environ.get('SUPABASE_ANON_KEY', 'YOUR_SUPABASE_ANON_KEY')\n\nif SUPABASE_URL == 'YOUR_SUPABASE_URL' or SUPABASE_ANON_KEY == 'YOUR_SUPABASE_ANON_KEY':\n    print(\"Please set SUPABASE_URL and SUPABASE_ANON_KEY environment variables.\")\nelse:\n    try:\n        auth_client = AuthClient(SUPABASE_URL, SUPABASE_ANON_KEY)\n\n        # Example: Sign up a new user\n        # Replace with unique email/password for testing\n        user_email = 'test@example.com'\n        user_password = 'strong-password'\n\n        # try:\n        #     response = auth_client.sign_up(user_email, user_password)\n        #     print(\"Sign up response:\", response.user)\n        #     print(\"Session:\", response.session)\n        # except Exception as e:\n        #     print(f\"Sign up failed (might already exist): {e}\")\n\n        # Example: Sign in an existing user\n        try:\n            response = auth_client.sign_in(user_email, user_password)\n            print(\"Sign in successful! User ID:\", response.user.id)\n            print(\"Access Token:\", response.session.access_token)\n        except Exception as e:\n            print(f\"Sign in failed: {e}\")\n\n        # Example: Get current user details (requires active session)\n        if 'response' in locals() and response.session:\n            try:\n                current_user_response = auth_client.get_user(response.session.access_token)\n                print(\"Current user email:\", current_user_response.user.email)\n            except Exception as e:\n                print(f\"Failed to get user details: {e}\")\n\n    except Exception as e:\n        print(f\"An error occurred during client initialization or operation: {e}\")\n","lang":"python","description":"Initializes the `AuthClient` with your Supabase URL and anon key, then demonstrates basic user sign-up and sign-in operations. Remember to replace placeholder environment variables with your actual Supabase project credentials. Sign-up is commented out to prevent repeated user creation."},"warnings":[{"fix":"Review the official `supabase-auth-py` and `supabase-py` v2 documentation. Ensure you're importing `AuthClient` from `supabase_auth.client` and adapting method calls (e.g., `sign_up`, `sign_in`) to the current API.","message":"When migrating from `supabase-py` v1 to v2, the internal `AuthClient` structure and interaction patterns significantly changed. If you previously accessed authentication functionality via `supabase.auth` in `supabase-py` v1 and are now using this standalone `supabase-auth` package or `supabase-py` v2, be aware of method signature changes and the explicit need to import `AuthClient` from `supabase_auth.client`.","severity":"breaking","affected_versions":"supabase-py < 2.0.0 (indirectly affected `supabase-auth` usage patterns)"},{"fix":"Ensure that `AuthClient` is configured to handle session refreshing or implement your own robust session management logic, including storing and refreshing tokens. The `supabase-py` client's `auth` property often abstracts some of this, but if using `supabase-auth` standalone, explicit handling might be required.","message":"Properly managing user sessions and token refreshing is crucial for long-lived applications. While `AuthClient` can handle token refreshing, incorrect configuration or manual management can lead to expired sessions and unauthorized requests.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Double-check your environment variables and ensure they match your Supabase project settings. For RLS issues, verify that your database policies allow the intended operations for authenticated and unauthenticated users.","message":"Incorrectly setting `SUPABASE_URL` and `SUPABASE_ANON_KEY` or having misconfigured RLS (Row Level Security) policies on your Supabase project can lead to `AuthApiError` exceptions (e.g., 'Invalid API key' or 'Permission denied').","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'2.28.3':53 'auth':2,7,17,71 'authent':70 'broader':62 'cadenc':59 'client':3,12,47,73 'compon':34 'current':50 'direct':37 'ecosystem':65 'enabl':19 'follow':56 'foundat':33 'frequent':67 'full':46 'function':20 'interact':14 'jwt':72 'librari':9,48 'like':21 'login':24 'manag':26 'often':35 'part':40 'password':28 'provid':10 'py':45 'python':8,64 'recoveri':29 'registr':23 'releas':58 'servic':18 'session':25 'supabas':1,6,16,44,63,69 'supabase-auth':5 'supabase-pi':43 'updat':68 'use':36 'user':22 'version':51","created_at":"2026-04-09T04:00:50.499501+00:00","updated_at":"2026-04-16T22:32:57.460227+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.31.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://supabase.com","github":"https://github.com/supabase/supabase-py","docs":"https://github.com/supabase/supabase-py/tree/main/src/auth","changelog":"https://github.com/supabase/supabase-py/tree/main/CHANGELOG.md","pypi":"https://pypi.org/project/supabase-auth/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-27","next_check":"2026-08-02","install_tag":null}}