aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorGravatar hunteraraujo <hunter_araujo@msn.com> 2023-10-03 12:51:49 -0700
committerGravatar GitHub <noreply@github.com> 2023-10-03 12:51:49 -0700
commit0d5c2a98c071336e1bb48716cc25d85df2656ced (patch)
treee92a7216597d383d71d74f82f903b2d1b579844b /frontend
parentHeisenberg entering the arena (#5460) (diff)
downloadAuto-GPT-0d5c2a98c071336e1bb48716cc25d85df2656ced.tar.gz
Auto-GPT-0d5c2a98c071336e1bb48716cc25d85df2656ced.tar.bz2
Auto-GPT-0d5c2a98c071336e1bb48716cc25d85df2656ced.zip
Implement Redirect Authentication for Google and GitHub Sign-In (#5515)
Diffstat (limited to 'frontend')
-rw-r--r--frontend/lib/services/auth_service.dart23
1 files changed, 8 insertions, 15 deletions
diff --git a/frontend/lib/services/auth_service.dart b/frontend/lib/services/auth_service.dart
index dac4db90b..3cbb3b9c7 100644
--- a/frontend/lib/services/auth_service.dart
+++ b/frontend/lib/services/auth_service.dart
@@ -7,31 +7,24 @@ class AuthService {
clientId:
"387936576242-iejdacrjljds7hf99q0p6eqna8rju3sb.apps.googleusercontent.com");
- // Sign in with Google
+// Sign in with Google using redirect
Future<UserCredential?> signInWithGoogle() async {
try {
- final GoogleSignInAccount? googleSignInAccount =
- await googleSignIn.signIn();
- if (googleSignInAccount != null) {
- final GoogleSignInAuthentication googleSignInAuthentication =
- await googleSignInAccount.authentication;
- final AuthCredential credential = GoogleAuthProvider.credential(
- accessToken: googleSignInAuthentication.accessToken,
- idToken: googleSignInAuthentication.idToken,
- );
- return await _auth.signInWithCredential(credential);
- }
+ final GoogleAuthProvider googleProvider = GoogleAuthProvider();
+ await _auth.signInWithRedirect(googleProvider);
+ return await _auth.getRedirectResult();
} catch (e) {
print("Error during Google Sign-In: $e");
return null;
}
}
- // Sign in with GitHub
+// Sign in with GitHub using redirect
Future<UserCredential?> signInWithGitHub() async {
try {
- final GithubAuthProvider provider = GithubAuthProvider();
- return await _auth.signInWithPopup(provider);
+ final GithubAuthProvider githubProvider = GithubAuthProvider();
+ await _auth.signInWithRedirect(githubProvider);
+ return await _auth.getRedirectResult();
} catch (e) {
print("Error during GitHub Sign-In: $e");
return null;