MCPcopy Create free account
hub / github.com/freecodexyz/free-code / handleSubmitCode

Function handleSubmitCode

src/components/ConsoleOAuthFlow.tsx:157–190  ·  view source on GitHub ↗
(value: string, url: string)

Source from the content-addressed store, hash-verified

155 }
156 }, [pastedCode, oauthStatus, showPastePrompt, urlCopied]);
157 async function handleSubmitCode(value: string, url: string) {
158 try {
159 // Expecting format "authorizationCode#state" from the authorization callback URL
160 const [authorizationCode, state] = value.split('#');
161 if (!authorizationCode || !state) {
162 setOAuthStatus({
163 state: 'error',
164 message: 'Invalid code. Please make sure the full code was copied',
165 toRetry: {
166 state: 'waiting_for_login',
167 url
168 }
169 });
170 return;
171 }
172
173 // Track which path the user is taking (manual code entry)
174 logEvent('tengu_oauth_manual_entry', {});
175 oauthService.handleManualAuthCodeInput({
176 authorizationCode,
177 state
178 });
179 } catch (err: unknown) {
180 logError(err);
181 setOAuthStatus({
182 state: 'error',
183 message: (err as Error).message,
184 toRetry: {
185 state: 'waiting_for_login',
186 url
187 }
188 });
189 }
190 }
191 const startOAuth = useCallback(async () => {
192 try {
193 logEvent('tengu_oauth_flow_start', {

Callers 1

OAuthStatusMessageFunction · 0.70

Calls 3

logEventFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected