OAuthApplication - Types - Next.js | Clerk Docs
OAuthApplication
The OAuthApplication object provides helpers for building custom OAuth consent flows in Clerk.
Use this object together with the useOAuthConsent() hook or the
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
Parameters
Name
clientId
Typestring
DescriptionThe OAuth
client_idfrom the authorize request.
Example
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>
GetOAuthConsentInfoParams
Name
oauthClientId
Typestring
DescriptionThe OAuth
client_idfrom the authorize request.Name
scope?
Typestring
DescriptionA space-delimited scope string from the authorize request.
Example
const consentInfo = await clerk.oauthApplication.getConsentInfo({
oauthClientId: clientId,
scope,
})