diff options
author | hunteraraujo <hunter_araujo@msn.com> | 2023-10-05 22:32:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-05 22:32:54 -0700 |
commit | 5e6b348685ccc140a790e86f1364a83e155a089e (patch) | |
tree | 2777e3315726304b61a740de53f39ded46a7e843 /frontend | |
parent | Update frontend build (#5567) (diff) | |
download | Auto-GPT-5e6b348685ccc140a790e86f1364a83e155a089e.tar.gz Auto-GPT-5e6b348685ccc140a790e86f1364a83e155a089e.tar.bz2 Auto-GPT-5e6b348685ccc140a790e86f1364a83e155a089e.zip |
Swap out pop up auth for redirect (#5568)
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/lib/services/auth_service.dart | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/frontend/lib/services/auth_service.dart b/frontend/lib/services/auth_service.dart index 62941e31b..734b0661c 100644 --- a/frontend/lib/services/auth_service.dart +++ b/frontend/lib/services/auth_service.dart @@ -7,7 +7,7 @@ class AuthService { clientId: "387936576242-iejdacrjljds7hf99q0p6eqna8rju3sb.apps.googleusercontent.com"); -// Sign in with Google using popup +// Sign in with Google using redirect Future<UserCredential?> signInWithGoogle() async { try { final GoogleAuthProvider googleProvider = GoogleAuthProvider(); @@ -28,8 +28,8 @@ class AuthService { // Step 3: Update OAuth 2.0 provider configuration dynamically googleProvider.setCustomParameters({'redirect_uri': redirectUri}); - // Use signInWithPopup instead of signInWithRedirect - final result = await _auth.signInWithPopup(googleProvider); + await _auth.signInWithRedirect(googleProvider); + final result = await _auth.getRedirectResult(); print(result); return result; } catch (e) { @@ -38,7 +38,7 @@ class AuthService { } } -// Sign in with GitHub using popup +// Sign in with GitHub using redirect Future<UserCredential?> signInWithGitHub() async { try { final GithubAuthProvider githubProvider = GithubAuthProvider(); @@ -59,9 +59,8 @@ class AuthService { // Step 3: Update OAuth 2.0 provider configuration dynamically githubProvider.setCustomParameters({'redirect_uri': redirectUri}); - // Use signInWithPopup instead of signInWithRedirect - final result = await _auth.signInWithPopup(githubProvider); - return result; + await _auth.signInWithRedirect(githubProvider); + return await _auth.getRedirectResult(); } catch (e) { print("Error during GitHub Sign-In: $e"); return null; |