首页 > 解决方案 > 通过谷歌登录AWS时反应本机时出错

问题描述

我通过谷歌处理AWS登录。我正在关注此链接https://github.com/patw0929/react-native-cognito-login-example但我遇到了 AWS 问题。我已经在链接中添加了 aws-sdk-react-native-core 的库但是在运行应用程序时出现错误。

java:45: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: C:\Users\krishna21\Awsslogin\node_modules\aws-sdk-react-native-core\android\src\main\java\com\amazonaws\reactnative\core\BackgroundRunner.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':aws-sdk-react-native-core:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

我已经手动添加了 aws-sdk-react-native-core。

标签: javascriptamazon-web-servicesreact-nativegoogle-signin

解决方案


John, 1. 首先,您使用的库很旧,请尝试改用 AWS Amplify,它在功能上要优越得多,并且已经过安全性和错误测试。2. 在 AWS 联合登录中,可以通过两种方式完成,一种使用 Cognito 用户池以及使用 Cognito 身份池。我希望您使用的是 Cognito 身份池。3. 请在 Edit identity pool->Authentication providers->Google+ 中添加 Google Client ID 4. 将您在 Google Developer 帐户中点击的域列入白名单。

完整文档在这里https://itnext.io/google-sign-in-using-aws-amplify-and-amazon-cognito-69cc3bf219ad

https://aws.amazon.com/blogs/mobile/amplify-framework-adds-authentication-features-and-enhancements-for-ios-and-android-mobile-sdks/


推荐阅读