【发布时间】:2021-03-25 22:56:37
【问题描述】:
我正在关注 Amplify 文档以向我的 Android 应用程序添加身份验证。我在这条线上收到了AuthException:
Amplify.addPlugin(AWSCognitoAuthPlugin())
我确实创建了一个用户池。我需要以某种方式附加它吗?我猜AWSMobileClient 有问题。
这是我的Application 课程:
class AppUtils : Application() {
override fun onCreate() {
super.onCreate()
try {
Amplify.addPlugin(AWSCognitoAuthPlugin())
Amplify.configure(applicationContext)
Log.d(TAG, "Initialized Amplify")
} catch (error: AmplifyException) {
Log.e(TAG, "Could not initialize Amplify", error)
}
}
}
这是在 logcat 中显示的错误:
AuthException{message=无法实例化 AWSMobileClient,原因=java.lang.RuntimeException:未使用 Cognito Identity 或 Cognito UserPool。必须至少存在一个才能使用 AWSMobileClient。,recoverySuggestion=有关更多详细信息,请参阅附加的异常}
【问题讨论】:
标签: android authentication amazon-cognito aws-amplify