RN 0.59 and Cognito federated identity OAuth flow failure
See original GitHub issueDescribe the bug With newest version of react-native the OAuth flow with Cognito Federated Identity fails to sign in the user.
To Reproduce Steps to reproduce the behavior:
- In a component wrapped with
withOAuth
HOC use props.facebookSignIn flow. - The flow will get the code from FB but will fail to get the tokens
Expected behavior Expected the flow to work properly
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- iOS
- RN 0.59 +
- aws-amplify 1.1.26
- aws-amplify-react-native 2.1.10
Smartphone (please complete the following information):
- iPhone 8plus
- iOS 12.2
- RN 0.59 +
Additional context Add any other context about the problem here.
Sample code
const urlOpener = async (url, redirectUrl) => {
const { type, url: newUrl } = await WebBrowser.openAuthSessionAsync(url, redirectUrl);
if (type === 'success') {
await WebBrowser.dismissBrowser();
if (Platform.OS === 'ios') {
return Linking.openURL(newUrl);
}
}
};
Amplify.configure({
Auth: {
oauth: {
domain: Config.REACT_APP_COGNITO_DOMAIN,
scope: ['public_profile', 'email'],
redirectSignIn: `app://signIn`,
redirectSignOut: `app://signOut`,
responseType: 'code',
urlOpener,
}
....
<Button onPress={this.props.facebookSignIn} >
You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Identity pools (federated identities) authentication flow
Describes authentication flow in Amazon Cognito. ... GetOpenIdToken returns a new OAuth 2.0 token that is issued by your identity pool.
Read more >The Complete Guide to User Authentication with the Amplify ...
Amazon Cognito makes this process easy by allowing you to use a single user registry to authenticate users across multiple authentication types.
Read more >detox - OSCHINA - 中文开源技术交流社区
React Native 0.59.9 发布了。React Native 使开发者只使用 JavaScript 也能编写原生移动应用。 新版本是针对几个 ScrollView 回归的补丁修复版本,更新内容如下: ...
Read more >Authentication - Social sign-in (OAuth) - JavaScript
OAuth support in Amplify uses Cognito User Pools and supports federation with social providers, which will automatically create a corresponding user in the ......
Read more >Enable Oauth2 authentication with Cognito
User Pools provide user profiles and authentication tokens for users who sign up directly and for federated users who sign in with social...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mkrn @schellack I can confirm that updating the code with the polyfill and deleting the global results in the same
Can't find variable: URLSearchParams
. Is there a 3rd party we could use to polyfill with the same api that was previously used?@mkrn thanks for posting that workaround. It looks like deleting the URLSearchParams from global causes other issues, even though it does allow auth to start working again.
After implementing your workaround, did you see errors like the one below? If so, how did you work around it?