Created
July 8, 2025 11:17
-
-
Save jacobsapps/193b0a995a4234b5444dc6d6c185bd50 to your computer and use it in GitHub Desktop.
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
import AuthenticationServices | |
func signInWithGoogle() async throws -> String { | |
try await withCheckedThrowingContinuation { continuation in | |
let session = ASWebAuthenticationSession( | |
url: URL(string: "https://oauth.example.com/auth")!, | |
callbackURLScheme: "myapp" | |
) { callbackURL, error in | |
if let error = error { | |
continuation.resume(throwing: error) | |
} else if let token = callbackURL?.lastPathComponent { | |
continuation.resume(returning: token) | |
} | |
} | |
session.start() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment