Swift: Get user claims from verified JWT

Parameters

Examples

Verify and get claims from current session

let response = try await supabase.auth.getClaims()
print("User ID: \(response.claims.sub ?? "N/A")")
print("Email: \(response.claims.email ?? "N/A")")
print("Role: \(response.claims.role ?? "N/A")")

Verify and get claims from a specific JWT

let customToken = "eyJhbGci..."
let response = try await supabase.auth.getClaims(jwt: customToken)

Get claims from an expired JWT

let response = try await supabase.auth.getClaims(
  options: GetClaimsOptions(allowExpired: true)
)

Verify JWT with custom JWKS

let customJWKS = JWKS(keys: [...])
let response = try await supabase.auth.getClaims(
  options: GetClaimsOptions(jwks: customJWKS)
)