Got error while using amazon cognito with Auth0

Hi,

I want to use Amazon Cognito with Auth0. I have reviewed this document for the same.

With this information, we have tried it for our own app. But it shows error. I have verified that everything is configured properly but don’t know where is the issue. You can found more information from below StackOverflow link.

Can anyone please be helpful here to identify the issue.

Thanks.

Hey there @ronak.sharma, can you share with us a bit more detail about the error you are experiencing? I referenced the stack overflow link you shared but I didn’t see any direct details relating to Auth0 that I could assist with. Thanks in advance!

Can you please tell me which details you want? So I can provide that to resolved this issue.

No problem @ronak.sharma, Let’s start with the sharing the exact problem you are experiencing when using Auth0. Are you able to have an end user successfully authenticate? When I looked at the StackOverflow link you shared it appears to resonate with an AWS error from uploading profile picture. When does this happen in your workflow? I also see that you have opened a similar topic on the AWS forums as well by the link in StackOverflow.

I just want to help to make sure that if you are experiencing an error with Auth0, we can work together to get it resolved. Thanks!

Yes. Fine.

So, I successfully authenticate and get the AccessToken from Auth0. I also pass that to cognito with auth0 provider. But When do so, I got error. Without logins provider, it works well. But I want to have login provider in the process of profile Image upload, to authenticate the user.

Hope you got my point. Do let me know if there is an issue with this.
Thanks.

Hi @James.Morrison Can you please help me with this. Let me know if you need any details towards that. Waiting to have a resolution to this.

Thanks a lot.

When you get a chance @ronak.sharma can you please record a har file of the login flow that exhibits the issue, be sure to select “Preserve log” to catch redirects and scrub the file of user passwords before passing it in a direct message. This will give us the ability to take a deeper look at what may be occurring, thanks!

@James.Morrison
The HAR file can be generated from Browser. The issue I am facing is in Mobile Build. So, is there something which I can provide in term of the mobile related issue?

I wanted to follow up and see if you were able to snag any additional details that we can use to troubleshoot this challenge you are facing? Please let me know if you have any other questions we can assist with.

@James.Morrison
If you can provide which details you want, then I can provide that to you and it can be helpful to resolved this issue. Can you please update me for same.

@James.Morrison

If you can please detail me the details that you want, I can help you with that. because I really need help with this. Can you please check with this and update me for same.

@ronak.sharma I am happy to assist you, I just need the exact error you are experiencing to verify where the source of the error is coming from and if it’s actually with Auth0. When I look at the links you shared previously in your other open discussion on Stack Overflow I don’t see an Auth0 error. I took a look at this with one of our senior support members and didn’t see where Auth0 may be inflecting an error. I want to help you get through this but we can’t fix your code that doesn’t pertain to Auth0. I hope this provides some context, thank you.

@James.Morrison

FYI, I got below error when I am going to integrate amazon cognito with Auth0 as per the below link:

Logins don't match. Please include at least one valid login for this identity or identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: 0fafe672-2863-11e9-8f0e-cdc8b612afa1)

This is when I put the below lines of code in my existing code.

Map<String, String> logins = new HashMap<>();
logins.put("myname.auth0.com", "Bearer "+ accessToken);
AppLogger.d(getTag(), logins.toString());
credentialsProvider.setLogins(logins);

Let me know if that is something related to auth0 or not. If not then I need to check with Amazon Cognito for same.
Thanks.

After looking over the latest data you sent with our support team, it appears to be related to a AWS and not Auth0. There’s a couple possibilities that may bring out a solution below.

[…]After you’ve already logged in with one user’s access token, using a different user’s token will result in this error, no matter if the other user is a test user or a real user. It seems that something gets cached after you first log in. In order to solve it, you need to call the Clear() method of the CognitoAWSCredentials object in order to delete whatever it is that is cached. After that, the new access token will work normally.

Your initial topic referenced this Stack Overflow thread but there are two listed possible solutions at the end of it.

@James.Morrison

Hi,

I have created a demo for the same. Here some of the information required to be entered to check the demo app. If you provide me your email, I can share such information to you over there. I can’t share such information over here as it is sensitive information.

LoginProviderExample

The required details need to be filled into the string.xml file.

Can you please check this once and do let me know whether you can help me with this or not.

Thanks for your time and understanding.

@James.Morrison

Hi, Can you please review above given example and update me if the update is required from auth0 configuration.

Thanks.

Following up @ronak.sharma as I’ve been out of office, you can send the sensitive details you wish to share via a direct message here on Community. From there i would be happy to review, Thanks!

@James.Morrison

I have sent you the details in your email.

Thanks.

After talking with a senior engineer, reviewing the code you sent over and it still appears that the error is directly associated with AWS, not Auth0. To move forward on this subject we would recommend requesting support from Amazon as the 400 is coming directly from Amazon. This is likely do to something being returned that is malformed or not expected. I understand this can bring a level of frustration as you proceed but from the looks of what you have shared, Amazon should be able to point you in the right direction on the breakdown on their end. Thank you for your patience.

ok. Thanks for your help and support.

1 Like