-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[expo-auth-session][google] Second call to promptAsync doesn't trigger a useEffect after response #11714
Comments
Here's my patch for diff --git a/node_modules/expo-auth-session/build/providers/Google.js b/node_modules/expo-auth-session/build/providers/Google.js
old mode 100644
new mode 100755
index 9cac987..0c7064d
--- a/node_modules/expo-auth-session/build/providers/Google.js
+++ b/node_modules/expo-auth-session/build/providers/Google.js
@@ -214,7 +214,7 @@ export function useAuthRequest(config = {}, redirectUriOptions = {}) {
});
}
else {
- setFullResult(fullResult ?? result);
+ setFullResult(result);
}
return () => {
isMounted = false;
@@ -227,6 +227,7 @@ export function useAuthRequest(config = {}, redirectUriOptions = {}) {
config.scopes?.join(','),
request?.codeVerifier,
fullResult,
+ result
]);
return [request, fullResult, promptAsync];
} |
I did the fix from @Grohden but now i get dismiss as response.type on a Android device on a standalone build. On iOS everything works as expected. |
I faced the same problem using expo-auth-session. Referring to AuthSession documentation, the scheme should be the same as android.package in app.json, as mentioned here: "Your app needs to conform to the URI scheme matching your android.package (ex. com.myname.mycoolapp:/)". Now everything's work fine after changing it. Hope this helps. |
It partially works, because after doing this, the user needs to choose which application to open to complete the redirection flow. There is another discussion here about this same issue: |
If you look at the generated apk manifest you will see that the scheme is automatically added, at least in mine it was added correctly and if I send an intent for that scheme it opens my app... Did you configured it somewhere else? Like in the auth package? |
This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem. |
🐛 Bug Report
Summary of Issue
I'm using the
expo-auth-session
package and I've noticed that theuseEffect
recommended in the guide to handle the response doesn't trigger if I login, logout and login again. I'm not sure if this is caused by external dependencies like react-navigation.. but I was able to solve it by changing this line here:expo/packages/expo-auth-session/src/providers/Google.ts
Lines 358 to 360 in 95a84b5
To just:
But this is just to login and I'm assuming that it will not fail, so I'm not sure that this is the proper fix...
Environment - output of
expo diagnostics
& the platform(s) you're targetingI'm running dev in android, managed workflow.
Reproducible Demo
I'm assuming that this stack overflow question code will trigger the same issue:
Steps to Reproduce
Try to login twice using the oauth workflow, the second time it will not trigger the
useEffect
Expected Behavior vs Actual Behavior
Effect deps should change after the response is received
The text was updated successfully, but these errors were encountered: