MCPcopy
hub / github.com/gitify-app/gitify / initializeDeviceFlow

Function initializeDeviceFlow

src/renderer/routes/LoginWithDeviceFlow.tsx:64–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 // Initialize device flow session, copy code, and open browser
63 useEffect(() => {
64 const initializeDeviceFlow = async () => {
65 try {
66 const scopes =
67 scopeChoice === 'public'
68 ? getAlternateScopeNames()
69 : getRecommendedScopeNames();
70
71 const newSession = await loginWithDeviceFlowStart(
72 reAuthAccount?.hostname,
73 scopes,
74 );
75 setSession(newSession);
76
77 // Auto-copy the user code to clipboard
78 await copyToClipboard(newSession.userCode);
79
80 // Auto-open the verification URL in the browser
81 openExternalLink(newSession.verificationUri as Link);
82 } catch (err) {
83 rendererLogError(
84 'LoginWithDeviceFlow',
85 'Failed to start device flow',
86 toError(err),
87 );
88 setError('Failed to start authentication. Please try again.');
89 }
90 };
91
92 if (scopeChoice) {
93 initializeDeviceFlow();

Callers 1

LoginWithDeviceFlowRouteFunction · 0.85

Calls 6

getAlternateScopeNamesFunction · 0.90
getRecommendedScopeNamesFunction · 0.90
copyToClipboardFunction · 0.90
openExternalLinkFunction · 0.90
rendererLogErrorFunction · 0.90
toErrorFunction · 0.90

Tested by

no test coverage detected