mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Swap out pop up auth for redirect (#5568)
This commit is contained in:
@@ -7,7 +7,7 @@ class AuthService {
|
|||||||
clientId:
|
clientId:
|
||||||
"387936576242-iejdacrjljds7hf99q0p6eqna8rju3sb.apps.googleusercontent.com");
|
"387936576242-iejdacrjljds7hf99q0p6eqna8rju3sb.apps.googleusercontent.com");
|
||||||
|
|
||||||
// Sign in with Google using popup
|
// Sign in with Google using redirect
|
||||||
Future<UserCredential?> signInWithGoogle() async {
|
Future<UserCredential?> signInWithGoogle() async {
|
||||||
try {
|
try {
|
||||||
final GoogleAuthProvider googleProvider = GoogleAuthProvider();
|
final GoogleAuthProvider googleProvider = GoogleAuthProvider();
|
||||||
@@ -28,8 +28,8 @@ class AuthService {
|
|||||||
// Step 3: Update OAuth 2.0 provider configuration dynamically
|
// Step 3: Update OAuth 2.0 provider configuration dynamically
|
||||||
googleProvider.setCustomParameters({'redirect_uri': redirectUri});
|
googleProvider.setCustomParameters({'redirect_uri': redirectUri});
|
||||||
|
|
||||||
// Use signInWithPopup instead of signInWithRedirect
|
await _auth.signInWithRedirect(googleProvider);
|
||||||
final result = await _auth.signInWithPopup(googleProvider);
|
final result = await _auth.getRedirectResult();
|
||||||
print(result);
|
print(result);
|
||||||
return result;
|
return result;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -38,7 +38,7 @@ class AuthService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sign in with GitHub using popup
|
// Sign in with GitHub using redirect
|
||||||
Future<UserCredential?> signInWithGitHub() async {
|
Future<UserCredential?> signInWithGitHub() async {
|
||||||
try {
|
try {
|
||||||
final GithubAuthProvider githubProvider = GithubAuthProvider();
|
final GithubAuthProvider githubProvider = GithubAuthProvider();
|
||||||
@@ -59,9 +59,8 @@ class AuthService {
|
|||||||
// Step 3: Update OAuth 2.0 provider configuration dynamically
|
// Step 3: Update OAuth 2.0 provider configuration dynamically
|
||||||
githubProvider.setCustomParameters({'redirect_uri': redirectUri});
|
githubProvider.setCustomParameters({'redirect_uri': redirectUri});
|
||||||
|
|
||||||
// Use signInWithPopup instead of signInWithRedirect
|
await _auth.signInWithRedirect(githubProvider);
|
||||||
final result = await _auth.signInWithPopup(githubProvider);
|
return await _auth.getRedirectResult();
|
||||||
return result;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("Error during GitHub Sign-In: $e");
|
print("Error during GitHub Sign-In: $e");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user