Skip to content

Commit 42a7fdd

Browse files
committed
retry tray. delete cancelpkce
1 parent d0a8b85 commit 42a7fdd

File tree

2 files changed

+22
-9
lines changed
  • crates/fig_desktop_api/src
  • packages/dashboard-app/src/components/installs/modal/login

2 files changed

+22
-9
lines changed

crates/fig_desktop_api/src/handler.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ where
258258
AuthBuilderIdStartDeviceAuthorizationRequest(request) => {
259259
auth::builder_id_start_device_authorization(request, &ctx).await
260260
},
261-
AuthStartUnifiedPortalRequest(request) => auth::start_unified_portal(request).await,
261+
AuthStartUnifiedPortalRequest(request) => {
262+
let result = auth::start_unified_portal(request).await;
263+
event_handler.user_logged_in_callback(ctx).await;
264+
result
265+
},
262266
AuthBuilderIdPollCreateTokenRequest(request) => auth::builder_id_poll_create_token(request, &ctx).await,
263267
// codewhisperer api
264268
CodewhispererListCustomizationRequest(request) => codewhisperer::list_customization(request).await,

packages/dashboard-app/src/components/installs/modal/login/index.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export default function LoginModal({ next }: { next: () => void }) {
7171
try {
7272
setError(null);
7373
setLoginState("loading");
74+
setPkceTimedOut(false);
75+
setAuthRequestId(undefined);
76+
7477
const res = await Auth.startUnifiedPortal({});
7578

7679
// Handle social login (Google/GitHub)
@@ -90,9 +93,6 @@ export default function LoginModal({ next }: { next: () => void }) {
9093

9194
if (isSsoKind && res.issuerUrl && res.idcRegion) {
9295
// Start PKCE auth
93-
setPkceTimedOut(false);
94-
setAuthRequestId(undefined);
95-
9696
const init = await Auth.startPkceAuthorization({
9797
issuerUrl: res.issuerUrl,
9898
region: res.idcRegion,
@@ -295,7 +295,6 @@ export default function LoginModal({ next }: { next: () => void }) {
295295
setLoginMethod("deviceCode");
296296
setLoginState("not started");
297297
setError(null);
298-
Auth.cancelPkceAuthorization().catch(console.error);
299298
}}
300299
>
301300
Login with Device Code
@@ -322,7 +321,6 @@ export default function LoginModal({ next }: { next: () => void }) {
322321
setLoginMethod("deviceCode");
323322
setLoginState("not started");
324323
setError(null);
325-
Auth.cancelPkceAuthorization().catch(console.error);
326324
}}
327325
>
328326
Try authenticating with device code
@@ -336,7 +334,6 @@ export default function LoginModal({ next }: { next: () => void }) {
336334
onClick={() => {
337335
setLoginState("not started");
338336
setError(null);
339-
Auth.cancelPkceAuthorization().catch(console.error);
340337
}}
341338
>
342339
Back
@@ -357,7 +354,13 @@ export default function LoginModal({ next }: { next: () => void }) {
357354
? () => setTab("iam")
358355
: () => setTab("builderId")
359356
}
360-
signInText={completedOnboarding ? "Log back in" : "Sign in"}
357+
signInText={
358+
completedOnboarding
359+
? tab === "builderId"
360+
? "Login with Builder ID"
361+
: "Login with IDC"
362+
: "Sign in"
363+
}
361364
/>
362365
<Button
363366
variant="ghost"
@@ -563,7 +566,13 @@ export default function LoginModal({ next }: { next: () => void }) {
563566
? () => setTab("iam")
564567
: () => setTab("builderId")
565568
}
566-
signInText={completedOnboarding ? "Log back in" : "Sign in"}
569+
signInText={
570+
completedOnboarding
571+
? tab === "builderId"
572+
? "Login with Builder ID"
573+
: "Login with IDC"
574+
: "Sign in"
575+
}
567576
/>
568577
)}
569578
</div>

0 commit comments

Comments
 (0)