Supabase.GoTrue.Plug (supabase_gotrue v0.4.1)
Provides Plug-based authentication support for the Supabase GoTrue authentication in Elixir applications.
This module offers a series of functions to manage user authentication through HTTP requests in Phoenix applications. It facilitates operations like logging in with a password, logging out users, fetching the current user from a session, and handling route protections based on authentication state.
Configuration
The module requires some application environment variables to be set:
authentication_client
: The Supabase client used for authentication.endpoint
: Your web app endpoint, used internally for broadcasting user disconnection events.signed_in_path
: The route to where socket should be redirected to after authenticationnot_authenticated_path
: The route to where socket should be redirect to if user isn't authenticated
Usage
Typically, you need to define a module to be your Plug Authentication entrypoint and use this module to inject the necessary functions that you will use on your MyAppWeb.Router
.