MCPcopy Create free account
hub / github.com/BingyanStudio/github-analyzer / authenticateWithGitHub

Function authenticateWithGitHub

web/src/pages/Callback.tsx:24–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22 }
23
24 const authenticateWithGitHub = async () => {
25 try {
26 const response = await fetch(`/api/code?code=${code}`, {
27 method: 'GET',
28 credentials: 'include', // Important to include cookies
29 });
30
31 if (!response.ok) {
32 throw new Error(`Authentication failed: ${response.statusText}`);
33 }
34
35 // Set authentication state to true
36 setIsAuthenticated(true);
37
38 // Redirect to dashboard or home page
39 navigate("/dashboard");
40 } catch (err) {
41 setError(err instanceof Error ? err.message : "Authentication failed");
42 }
43 };
44
45 authenticateWithGitHub();
46 }, [searchParams, navigate, setIsAuthenticated]);

Callers 1

CallbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected