Repository navigation
Surface Sign In errors in Account settings #3624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 6 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
cd33724
Expose missing sign-in error state in tests
austinywang 239560a
Surface sign-in failures where users can act
austinywang f975e88
Merge remote-tracking branch 'origin/main' into issue-3617-sign-in-er…
austinywang d52dab0
Keep auth UI changes within Swift file budgets
austinywang 8f37f3d
Treat web auth cancellation as dismissal
austinywang 13f41d5
Keep raw auth errors out of Settings copy
austinywang 3f650e6
Retry macOS CI after Zig download instability
austinywang ab73452
Preserve sign-in progress while callbacks settle
austinywang 9aeb58f
Restart stalled external PR status contexts
austinywang 4b4d085
Short-circuit failed browser sign-in awaits
austinywang 20fad03
Make macOS CI tolerate transient Zig downloads
austinywang 1fe62ed
Integrate main before final CI verification
austinywang ce5f2ce
Restart stalled CircleCI workflow after merge
austinywang 4020b5e
Merge origin/main into issue-3617-sign-in-error-surface
austinywang f4bfd12
Hide auth logger helper
austinywang 7e597fc
Restart stalled external status contexts
austinywang 414cfc0
Avoid duplicate sign-in error assignment
austinywang 63256c6
Merge remote-tracking branch 'origin/main' into issue-3617-sign-in-er…
austinywang 82aa2e1
Await sign-in token persistence
austinywang 40b30ac
Restart stalled external status contexts
austinywang dc27731
Clear stale web auth sessions
austinywang 970f399
Guard stale web auth completions
austinywang 2bfa476
Fix web auth session actor isolation
austinywang 9b9b0b6
Mark auth sign-in state sendable
austinywang d1e1c09
Fix credential sign-in error state
austinywang ec1e057
Merge origin/main into issue-3617-sign-in-error-surface
austinywang 375e19e
Merge origin/main into issue-3617-sign-in-error-surface
austinywang 0d177da
Clear credential sign-in errors at attempt start
austinywang 599ce3b
Surface browser sign-in timeout errors
austinywang 32e2f96
Show generic copy for auth sign-in errors
austinywang 51e928b
Guard async sign-in state publication
austinywang 9c0b630
Import auth core in auth manager tests
austinywang c87e5b9
Guard stale callback sign-in errors
austinywang 646a325
Merge remote-tracking branch 'origin/main' into issue-3617-sign-in-er…
austinywang 4fe4bd1
Guard superseded credential sign-ins
austinywang 3cadbcb
fix: guard stale sign-in error state
austinywang c8d8d17
fix: keep credential sign-in supersession internal
austinywang 3cf371c
Merge remote-tracking branch 'origin/main' into issue-3617-sign-in-er…
austinywang 6b87919
Merge remote-tracking branch 'origin/main' into issue-3617-sign-in-er…
austinywang 8739c40
fix: clear stale apply sign-in errors
austinywang da3e087
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang 5e20521
Fix timed-out sign-in callback race
austinywang b8af3fa
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang 39fcbe4
Merge remote-tracking branch 'origin/main' into issue-3617-sign-in-er…
austinywang 7ecf7d6
Localize sign-in failure copy
austinywang 30c0278
Return authoritative sign-in await state
austinywang 826b0b0
merge: resolve main into sign-in error surface
austinywang 1ae341e
Merge origin/main into issue-3617-sign-in-error-surface
austinywang 385f953
Merge origin/main into issue-3617-sign-in-error-surface
austinywang d64f5f3
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang ba35199
Merge remote-tracking branch 'origin/main' into issue-3617-sign-in-er…
austinywang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import AuthenticationServices | ||
| import Foundation | ||
| import OSLog | ||
|
|
||
| enum AuthManagerError: LocalizedError, Equatable { | ||
| case invalidCallback | ||
| case missingAccessToken | ||
| case missingRefreshToken | ||
|
|
||
| var errorDescription: String? { | ||
| switch self { | ||
| case .invalidCallback: | ||
| return String( | ||
| localized: "settings.account.error.invalidCallback", | ||
| defaultValue: "The sign-in callback was invalid." | ||
| ) | ||
| case .missingAccessToken: | ||
| return String( | ||
| localized: "settings.account.error.missingAccessToken", | ||
| defaultValue: "Account access token is unavailable." | ||
| ) | ||
| case .missingRefreshToken: | ||
| return String( | ||
| localized: "settings.account.error.missingRefreshToken", | ||
| defaultValue: "Account refresh token is unavailable." | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| enum AuthSignInError: Equatable { | ||
| case authManager(AuthManagerError) | ||
| case message(String) | ||
|
|
||
| var localizedMessage: String { | ||
| switch self { | ||
| case .authManager(let error): | ||
| return error.errorDescription ?? Self.genericLocalizedMessage | ||
| case .message: | ||
| return Self.genericLocalizedMessage | ||
|
lawrencecchen marked this conversation as resolved.
Resolved
|
||
| } | ||
|
austinywang marked this conversation as resolved.
Resolved
|
||
| } | ||
|
austinywang marked this conversation as resolved.
Resolved
|
||
|
|
||
| private static var genericLocalizedMessage: String { | ||
| String( | ||
| localized: "settings.account.error.signInFailed", | ||
| defaultValue: "Sign in failed. Try again." | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| extension AuthManager { | ||
| nonisolated static let authLogger = Logger( | ||
| subsystem: Bundle.main.bundleIdentifier ?? AuthKeychainServiceName.stableFallback, | ||
| category: "auth" | ||
| ) | ||
|
|
||
| static func signInError(from error: Error) -> AuthSignInError { | ||
| if let authError = error as? AuthManagerError { | ||
| return .authManager(authError) | ||
| } | ||
| return .message((error as NSError).localizedDescription) | ||
| } | ||
|
|
||
| static func shouldSuppressWebAuthError(_ error: NSError) -> Bool { | ||
| error.domain == ASWebAuthenticationSessionError.errorDomain | ||
| && error.code == ASWebAuthenticationSessionError.canceledLogin.rawValue | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.