-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
aws-amplify-react-native version 2.1.10 breaks withOAuth Custom Provider Authentication #3057
Comments
Hi @jessedoyle I am working on a fix for this, thanks for the patience. |
@manueliglesias - Great - please let me know if you need some testing done! Thanks! |
@jessedoyle can you test again with the latest version? |
@undefobj - Sounds good, I’ll test on Monday and get back to you! |
@undefobj - I'm seeing the same behaviour as originally mentioned in the issue with the following package versions:
The error message |
I'm also getting failures with the new versions above. I'm seeing the following on authentication after being redirected back to the app
|
@undefobj - I did a bit of debugging recently. In React Native, the amplify-js/packages/auth/src/Auth.ts Line 1506 in d95cdac
null .
This means that I'm not sure it's safe to assume |
Okay, I think I've found the root cause of the issue. I inspected the network activity our application makes during authentication for multiple package versions. I tested the following versions: "working" versions
"non-working" versions
In both cases, a request with the following form was made:
With the "working" package versions, the error was not propagated up via props. With the "non-working" package versions, the error is delivered via props post authentication. I believe that we'll have a configuration change on our identity pool to accept an alternate user pool as a provider. After debugging, the main concern we have with the recent releases is the yellowbox warning due to the issue mentioned here. |
@jessedoyle Interesting, sounds like you've got a User Pool that is independent of your Identity Pool which is causing an error that was previously being swallowed but is now (correctly) bubbling up. We can look at fixing this, however is there a reason why you don't have the User Pool and Identity Pool connected? |
Nope, it's a configuration error on our end. We're not using the identity pool yet, so the error went under the radar for a while. |
I can confirm the similar behavior, Having new Also, the withOAuth + props.facebookSignIn flow doesn't authenticate the user. I'm getting the code correctly via my urlOpener but the aws-amplify lib fails to sign in the user... Currently trying to debug this, as this used to work.. |
I was able to debug further to get to where it fails for me: body is a string like: oAuthTokenEndpoint is Error is It seems to do with urlEncoding & using URLSearchParams I'm using Cognito User Pool with Facebook Federated Identity Provider. Any help greatly appreciated! |
Before anyone spends too much time: this issue apparently is related to RN 0.59.0 and the way they implemented URLSearchParams |
Looks like we're discussing 3 different issues:
|
* Use the `browserOrNode` to determine if running in a browser. When not running in a browser, we should not assume that the `window` global object is present. resolves: aws-amplify#3057
* Use the `browserOrNode` to determine if running in a browser. When not running in a browser, we should not assume that the `window` global object is present. * Fix additional whitespace at the end of the line that was caught by my text editor. resolves: aws-amplify#3057
* Use the `browserOrNode` to determine if running in a browser. When not running in a browser, we should not assume that the `window` global object is present. * This fixes a YellowBox warning in react native when using authentication. * Fix additional whitespace at the end of the line that was caught by my text editor. resolves: aws-amplify#3057
@calboru - In our case, the authorization error was bubbling up because we had our Identity Pool misconfigured (double check the "Authentication Providers" configuration section for your Identity Pool). The only remaining issue we have with the recent releases are the YellowBox warnings on React Native. I've submitted a PR to fix the bug here: #3230. |
I also got this error, |
fix(@aws-amplify/auth): react-native - guard for window reference
I am facing the same issue can anyone help ?? |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Describe the bug
After updating
aws-amplify
from version1.1.24
to1.1.25
andaws-amplify-react-native
from2.1.9
to2.1.10
, our React Native application's authentication with a custom provider on a Cognito User Pool no longer works using thewithOAuth
HOC.The error our app receives is (see screenshot 1):
At first glance, it looks like this PR introduced the bug: #3005. I have a comment on that PR that provides some initial details as well.
The upgrade also introduces a YellowBox warning in our app (see screenshot 2):
To Reproduce
Here is a code example similar to our code using the
withOAuth
HOC (generalized):Expected Behavior
After clicking the "Proceed to Login" button the user is redirected using the device's browser to the custom provider authentication page.
After the custom provider authenticates, the browser redirects to a deep link that opens our application and provides an OAuth2
code
parameter and grant.This process worked as expected with
aws-amplify-react-native == 2.1.9
andaws-amplify == 1.1.24
.Current Behavior
On
aws-amplify-react-native == 2.1.10
, the custom provider authentication works successfully in the browser and the deep link redirection occurs opening our application.After our application opens, Amplify returns the following error:
Screenshots
1 - Error
2 - Warning
The text was updated successfully, but these errors were encountered: