For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.
Swift: Retrieve a user
This method validates the user's access token JWT on the server and returns the authenticated user. It does not check what the user can do. Your RLS policies and endpoints do that.
Fetches the user object from the database instead of local session.
Should be used only when you require the most current user data. For faster results, currentUser is recommended.
user() sends the access token of the current session and refreshes it first when it has expired. user(jwt:) sends the token you pass as is.
Examples
Get the logged in user with the current existing session
let user = try await supabase.auth.user()
Get the logged in user with a custom access token jwt
let user = try await supabase.auth.user(jwt: "custom-jwt")