-
Notifications
You must be signed in to change notification settings - Fork 472
docs(shared): document OAuth device verification types #9678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/shared': patch | ||
| --- | ||
|
|
||
| Document the public fields, actions, and parameter types for OAuth device verification flows. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,31 +101,63 @@ export type OAuthConsentInfo = { | |
| scopes: OAuthConsentScope[]; | ||
| }; | ||
|
|
||
| /** | ||
| * The current status of an OAuth device authorization. | ||
| */ | ||
| export type OAuthDeviceVerificationStatus = 'pending' | 'approved' | 'denied' | 'consumed'; | ||
|
|
||
| /** | ||
| * A scope requested by an OAuth device authorization. | ||
| * | ||
| * @interface | ||
| */ | ||
| export type OAuthDeviceVerificationScope = OAuthConsentScope; | ||
|
|
||
| /** | ||
| * Information about an OAuth device authorization awaiting verification. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Use a status-neutral description for
🤖 Prompt for AI Agents |
||
| * | ||
| * @interface | ||
| */ | ||
| export type OAuthDeviceVerificationInfo = { | ||
| /** | ||
| * The display name of the OAuth application requesting authorization. | ||
| */ | ||
| oauthApplicationName: string; | ||
| /** | ||
| * The URL of the OAuth application's logo image, or `null` if no logo is available. | ||
| */ | ||
| oauthApplicationLogoUrl: string | null; | ||
| /** | ||
| * The OAuth `client_id` that identifies the application requesting authorization. | ||
| */ | ||
| clientId: string; | ||
| /** | ||
| * The scopes the OAuth application is requesting. | ||
| */ | ||
| scopes: OAuthDeviceVerificationScope[]; | ||
| /** | ||
| * The current status of the device authorization. | ||
| */ | ||
| status: OAuthDeviceVerificationStatus; | ||
| /** Expiration time as Unix milliseconds. */ | ||
| /** | ||
| * The expiration time of the device authorization, as a Unix timestamp in milliseconds. | ||
| */ | ||
| expiresAt: number; | ||
| }; | ||
|
|
||
| /** | ||
| * The result of approving or denying an OAuth device authorization. | ||
| * | ||
| * @interface | ||
| */ | ||
| export type OAuthDeviceVerificationResult = { | ||
| /** | ||
| * The type of the resource. | ||
| */ | ||
| object: 'oauth_device_verification'; | ||
| /** | ||
| * The final decision for the device authorization. | ||
| */ | ||
| status: Extract<OAuthDeviceVerificationStatus, 'approved' | 'denied'>; | ||
| }; | ||
|
|
||
|
|
@@ -138,13 +170,35 @@ export type GetOAuthConsentInfoParams = { | |
| redirectUri?: string; | ||
| }; | ||
|
|
||
| /** | ||
| * The parameters for looking up an OAuth device authorization. | ||
| * | ||
| * @interface | ||
| */ | ||
| export type LookupOAuthDeviceVerificationParams = { | ||
| /** | ||
| * The user code displayed by the device requesting authorization. | ||
| */ | ||
| userCode: string; | ||
| }; | ||
|
|
||
| /** | ||
| * The parameters for approving or denying an OAuth device authorization. | ||
| * | ||
| * @interface | ||
| */ | ||
| export type SubmitOAuthDeviceVerificationParams = { | ||
| /** | ||
| * The user code displayed by the device requesting authorization. | ||
| */ | ||
| userCode: string; | ||
| /** | ||
| * Whether to approve or deny the authorization request. | ||
| */ | ||
| approved: boolean; | ||
| /** | ||
| * The ID of the Organization to authorize the request for. Omit this to authorize the request for the user's personal account. | ||
| */ | ||
| organizationId?: string; | ||
| }; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Complete the JSDoc for the public actions.
lookup,approve,deny, andresetare public function-valued properties, but their added JSDoc blocks only describe behavior. Add@param,@returns,@throws, and@exampletags where applicable, using the actual parameter, return, and error contracts before publishing the TypeDoc output.As per coding guidelines: “Document functions with JSDoc comments including
@param,@returns,@throws, and@exampletags.”Also applies to: 43-43, 47-47, 51-51
🤖 Prompt for AI Agents
Source: Coding guidelines