OAuthApplication
The OAuthApplication object provides helpers for building custom OAuth consent flows in Clerk.
Use this object together with the useOAuthConsent() hook or the <OAuthConsent /> component when you need to render a custom consent page for an OAuth application.
Methods
buildConsentActionUrl()
Returns the URL to use as the action attribute of your consent form. Clerk includes the current session context automatically, including _clerk_session_id and, in development, the dev browser JWT.
function buildConsentActionUrl(params: { clientId: string }): string- Name
clientId- Type
string- Description
The OAuth
client_idfrom the authorize request.
const actionUrl = clerk.oauthApplication.buildConsentActionUrl({
clientId,
})getConsentInfo()
Loads the consent metadata for a signed-in user and OAuth application. Returns a OAuthConsentInfo object.
Use this method when you want to build your own consent UI without the useOAuthConsent() hook.
function getConsentInfo(params: GetOAuthConsentInfoParams): Promise<OAuthConsentInfo>- Name
oauthClientId- Type
string- Description
The OAuth
client_idfrom the authorize request.
- Name
scope?- Type
string- Description
A space-delimited scope string from the authorize request.
const consentInfo = await clerk.oauthApplication.getConsentInfo({
oauthClientId: clientId,
scope,
})Feedback
Last updated on