Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotAuthenticated is returned when a user is not authenticated ErrNotAuthenticated = fmt.Errorf("not authenticated") // ErrSessionExpired is returned when the session has expired ErrSessionExpired = fmt.Errorf("session expired") )
Functions ¶
func GetAccessToken ¶
GetAccessToken returns the current access token if valid
func IsAuthenticated ¶
func IsAuthenticated() bool
IsAuthenticated checks if there is a valid user session
func RequireAuth ¶
func RequireAuth() error
RequireAuth returns an error if no user is authenticated
Types ¶
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Username string `json:"username,omitempty"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
ExpiresAt time.Time `json:"expires_at"`
}
User represents an authenticated user
func FromSupabaseSession ¶
FromSupabaseSession creates a User from Supabase session
func GetCurrentUser ¶
func GetCurrentUser() *User
GetCurrentUser returns the currently authenticated user, if any
func GetUserFromContext ¶
GetUserFromContext retrieves the user from a context
Click to show internal directories.
Click to hide internal directories.