MCPcopy Create free account
hub / github.com/ShipSecAI/studio / handleConnect

Function handleConnect

frontend/src/pages/IntegrationsManager.tsx:149–176  ·  view source on GitHub ↗
(provider: IntegrationProvider)

Source from the content-addressed store, hash-verified

147 };
148
149 const handleConnect = async (provider: IntegrationProvider) => {
150 resetError();
151
152 if (!provider.isConfigured) {
153 setConfigProvider(provider);
154 return;
155 }
156
157 setConnectingProvider(provider.id);
158 try {
159 const redirectUri = `${window.location.origin}/integrations/callback/${provider.id}`;
160 const response = await api.integrations.startOAuth(provider.id, {
161 userId,
162 redirectUri,
163 scopes: buildRequestedScopes(provider),
164 });
165 window.location.href = response.authorizationUrl;
166 } catch (err) {
167 const message = err instanceof Error ? err.message : 'Failed to start OAuth session';
168 toast({
169 title: 'Could not start OAuth flow',
170 description: message,
171 variant: 'destructive',
172 });
173 } finally {
174 setConnectingProvider(null);
175 }
176 };
177
178 const handleConfigureProvider = (provider: IntegrationProvider) => {
179 resetError();

Callers 2

handleManualReconnectFunction · 0.85
IntegrationsManagerFunction · 0.85

Calls 2

buildRequestedScopesFunction · 0.85
startOAuthMethod · 0.80

Tested by

no test coverage detected