AuthOAuthServerApi
import type { AuthOAuthServerApi } from "https://esm.sh/@supabase/supabase-js@2.95.3/dist/index.d.mts";Contains all OAuth 2.1 authorization server user-facing methods. Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
These methods are used to implement the consent page.
§Methods
Approves an OAuth authorization request. Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
After approval, the user's consent is stored and an authorization code is generated. The response contains a complete redirect URL with the authorization code and state.
- The authorization ID to approve
- Optional parameters
- If false (default), automatically redirects the browser to the OAuth client. If true, returns the redirect_url without automatic redirect (useful for custom handling).
Redirect URL to send the user back to the OAuth client with authorization code
Denies an OAuth authorization request. Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
After denial, the response contains a redirect URL with an OAuth error (access_denied) to inform the OAuth client that the user rejected the request.
- The authorization ID to deny
- Optional parameters
- If false (default), automatically redirects the browser to the OAuth client. If true, returns the redirect_url without automatic redirect (useful for custom handling).
Redirect URL to send the user back to the OAuth client with error information
Retrieves details about an OAuth authorization request. Used to display consent information to the user. Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
This method returns one of two response types:
OAuthAuthorizationDetails: User needs to consent - show consent page with client infoOAuthRedirect: User already consented - redirect immediately to the OAuth client
Use type narrowing to distinguish between the responses:
if ('authorization_id' in data) {
// Show consent page
} else {
// Redirect to data.redirect_url
}
- The authorization ID from the authorization request
Authorization details or redirect URL depending on consent status
Lists all OAuth grants that the authenticated user has authorized. Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
Response with array of OAuth grants with client information and granted scopes
Revokes a user's OAuth grant for a specific client. Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
Revocation marks consent as revoked, deletes active sessions for that OAuth client, and invalidates associated refresh tokens.
- Revocation options
- The OAuth client identifier (UUID) to revoke access for
Empty response on successful revocation