Signed-off-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -4157,13 +4157,17 @@
|
||||
"description": "Optional default value for the key",
|
||||
"nullable": true
|
||||
},
|
||||
"device_code_flow": {
|
||||
"type": "boolean",
|
||||
"description": "Whether this OAuth flow uses the device code grant (RFC 8628)\nWhen true, the user must enter a verification code in the browser"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "The name of the configuration key (e.g., \"API_KEY\")"
|
||||
},
|
||||
"oauth_flow": {
|
||||
"type": "boolean",
|
||||
"description": "Whether this key should be configured using OAuth device code flow\nWhen true, the provider's configure_oauth() method will be called instead of prompting for manual input"
|
||||
"description": "Whether this key should be configured using an OAuth flow\nWhen true, the provider's configure_oauth() method will be called instead of prompting for manual input"
|
||||
},
|
||||
"primary": {
|
||||
"type": "boolean",
|
||||
|
||||
@@ -90,12 +90,17 @@ export type ConfigKey = {
|
||||
* Optional default value for the key
|
||||
*/
|
||||
default?: string | null;
|
||||
/**
|
||||
* Whether this OAuth flow uses the device code grant (RFC 8628)
|
||||
* When true, the user must enter a verification code in the browser
|
||||
*/
|
||||
device_code_flow?: boolean;
|
||||
/**
|
||||
* The name of the configuration key (e.g., "API_KEY")
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Whether this key should be configured using OAuth device code flow
|
||||
* Whether this key should be configured using an OAuth flow
|
||||
* When true, the provider's configure_oauth() method will be called instead of prompting for manual input
|
||||
*/
|
||||
oauth_flow: boolean;
|
||||
|
||||
@@ -56,6 +56,8 @@ function OAuthForm({
|
||||
}
|
||||
};
|
||||
|
||||
const isDeviceCodeFlow = provider.metadata.config_keys.some((key) => key.device_code_flow);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center gap-3 py-4">
|
||||
<Button
|
||||
@@ -68,7 +70,9 @@ function OAuthForm({
|
||||
{isLoading ? 'Signing in...' : `Sign in with ${provider.metadata.display_name}`}
|
||||
</Button>
|
||||
<p className="text-xs text-text-muted text-center">
|
||||
A browser window will open for you to complete the login.
|
||||
{isDeviceCodeFlow
|
||||
? 'A browser window will open and the verification code will be copied to your clipboard. Paste it in the browser to complete sign-in.'
|
||||
: 'A browser window will open for you to complete the login.'}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -281,7 +281,9 @@ export default function ProviderConfigurationModal({
|
||||
: `Sign in with ${provider.metadata.display_name}`}
|
||||
</Button>
|
||||
<p className="text-sm text-text-secondary text-center">
|
||||
A browser window will open for you to complete the login.
|
||||
{provider.metadata.config_keys.some((key) => key.device_code_flow)
|
||||
? 'A browser window will open and the verification code will be copied to your clipboard. Paste it in the browser to complete sign-in.'
|
||||
: 'A browser window will open for you to complete the login.'}
|
||||
</p>
|
||||
</div>
|
||||
) : provider.metadata.config_keys.length === 0 &&
|
||||
|
||||
Reference in New Issue
Block a user