You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've already followed this issue #1066 but it still not work.
Whenever I try to configure Amplify, i get:
E/ContentValues: Could not initialize Amplify
AuthException{message=Failed to instantiate AWSMobileClient, cause=java.lang.RuntimeException: Failed to initialize OAuth, please check your awsconfiguration.json, recoverySuggestion=See attached exception for more details}
at com.amplifyframework.auth.cognito.AWSCognitoAuthPlugin.configure(AWSCognitoAuthPlugin.java:240)
at com.amplifyframework.core.category.Category.configure(Category.java:91)
at com.amplifyframework.core.Amplify.configure(Amplify.java:150)
at com.amplifyframework.core.Amplify.configure(Amplify.java:120)
at com.example.aerofighters.MainActivity.onCreate(MainActivity.kt:27)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.RuntimeException: Failed to initialize OAuth, please check your awsconfiguration.json
at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:596)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
at java.lang.Thread.run(Thread.java:764)
Caused by: com.amazonaws.mobileconnectors.cognitoauth.exceptions.AuthInvalidParameterException: validation failed
at com.amazonaws.mobileconnectors.cognitoauth.Auth$Builder.validateCognitoAuthParameters(Auth.java:546)
at com.amazonaws.mobileconnectors.cognitoauth.Auth$Builder.build(Auth.java:486)
at com.amazonaws.mobile.client.AWSMobileClient._initializeHostedUI(AWSMobileClient.java:647)
at com.amazonaws.mobile.client.AWSMobileClient.access$400(AWSMobileClient.java:165)
at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:593)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
at java.lang.Thread.run(Thread.java:764)
Caused by: com.amazonaws.mobileconnectors.cognitoauth.exceptions.AuthInvalidParameterException: {"AppCognitoWebDomain":"invalid"}
at com.amazonaws.mobileconnectors.cognitoauth.Auth$Builder.validateCognitoAuthParameters(Auth.java:543)
at com.amazonaws.mobileconnectors.cognitoauth.Auth$Builder.build(Auth.java:486)
at com.amazonaws.mobile.client.AWSMobileClient._initializeHostedUI(AWSMobileClient.java:647)
at com.amazonaws.mobile.client.AWSMobileClient.access$400(AWSMobileClient.java:165)
at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:593)
at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
at java.lang.Thread.run(Thread.java:764)
And there is no way to take this exception away...
Goal:
Enable authentication using Amplify connected to Cognito, without socials, with username and password
What I've done:
So looking through the web, I've found that if I'm using Amplify, the file awsconfiguration.json is useless, and I should only care about amplifyconfiguration.json.
For this reason, i've run amplify add auth:
amplify add auth
Using service: Cognito, provided by: awscloudformation
The current configured provider is Amazon Cognito.
Do you want to use the default authentication and security configuration? Default configuration
Warning: you will not be able to edit these selections.
How do you want users to be able to sign in? Username
Do you want to configure advanced settings? No, I am done.
Successfully added auth resource XXXXXXXXXXXXX locally
Some next steps:
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
then I've pushed the configuration with amplify push, and using the issue previously linked, I've edited the configuration: like this (this is amplifyconfiguration.json):
The information in the amplifyconfiguration.json are been copied by the Cognito console, so they are supposed to correct(?)
EDIT:
With the same credentials that i have in the config, if i use the link that i can find here (https://your_domain/login?response_type=token&client_id=your_app_client_id&redirect_uri=your_callback_url) it shows the login form
The text was updated successfully, but these errors were encountered:
signIn (username - password sign in via your own native UI)
signInWithWebUi (username - password sign in through a hosted UI webview)
signInWithSocialWebUi - (sign in with Google, Facebook, etc)
Are you trying to use (1) or (2)?
For (1), you need to choose "Default Configuration". Once complete, run amplify push. At this point, you should expect NOT to have an OAuth object in your amplifyconfiguration.json.
For (2) or (3), you need to choose "Default configuration with Social Provider (Federation)". Admittedly, the wording is probably a little confusing, since (2) is not a social provider. At this point, you SHOULD expect to have an OAuth object in your amplifyconfiguration.json.
Note that we don't currently support (1) AND (2) or (3) in the same app. Please comment or add a reaction on this feature request, if that's something you want.
I had the same issue and traced it down to this bug: aws-amplify/aws-sdk-android#2842 which should now be fixed in aws-amplify/aws-sdk-android#2946 . I had initially an invalid domain in the amplifyconfiguration.json which was kept in the SharedPreferences and read from there. The domain should be in the following format: xxxx.auth.eu-central-1.amazoncognito.com, not https://xxxx.auth.eu-central-1.amazoncognito.com.
A workaround was to uninstall (to clear the SharedPreferences) and reinstall.
I've already followed this issue #1066 but it still not work.
Whenever I try to configure
Amplify
, i get:And there is no way to take this exception away...
Goal:
Enable authentication using Amplify connected to Cognito, without socials, with username and password
What I've done:
So looking through the web, I've found that if I'm using Amplify, the file
awsconfiguration.json
is useless, and I should only care aboutamplifyconfiguration.json
.For this reason, i've run
amplify add auth
:then I've pushed the configuration with
amplify push
, and using the issue previously linked, I've edited the configuration: like this (this isamplifyconfiguration.json
):The information in the
amplifyconfiguration.json
are been copied by the Cognito console, so they are supposed to correct(?)EDIT:
With the same credentials that i have in the config, if i use the link that i can find here (
https://your_domain/login?response_type=token&client_id=your_app_client_id&redirect_uri=your_callback_url
) it shows the login formThe text was updated successfully, but these errors were encountered: