I am following the Amplify docs for adding Authentication to my Android app. I'm getting an AuthException
on this line:
Amplify.addPlugin(AWSCognitoAuthPlugin())
I do have a user pool created. Do I need to attach it somehow? There is some problem with the AWSMobileClient
, I guess.
Here's my Application
class:
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)
}
}
}
Here's the error that shows up in logcat:
AuthException{message=Failed to instantiate AWSMobileClient, cause=java.lang.RuntimeException: Neither Cognito Identity or Cognito UserPool was used. At least one must be present to use AWSMobileClient., recoverySuggestion=See attached exception for more details}