Swift: Retrieve a user
- This method is useful for checking if the user is authorized because it validates the user's access token JWT on the server.
- 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,
session.user is recommended.
Examples
Get the signed-in user with the current existing session
let user = try await supabase.auth.user()
Get the signed-in user with a custom access token jwt
let user = try await supabase.auth.user(jwt: "custom-jwt")