简体   繁体   English

Amazon Web Services (AWS) Cognito 错误“令牌不是来自此身份池的受支持提供商。”

[英]Amazon Web Services (AWS) Cognito error "Token is not from a supported provider of this identity pool."

I am running this app from GitHub which allows a user to sign up and sign in to a Cognito Client App.我正在从 GitHub运行这个应用程序,它允许用户注册并登录到 Cognito 客户端应用程序。 I am using Eclipse IDE for Enterprise Java Developers Version: 2019-03 (4.11.0), Build id: 20190314-1200.我正在使用 Eclipse IDE for Enterprise Java Developers 版本:2019-03 (4.11.0),构建 ID:20190314-1200。 I have ensured that I put all the necessary credentials accurately.我确保我准确地输入了所有必要的凭据。 I am able to sign up using both the form and the console.我可以同时使用表单和控制台进行注册。

When I try to sign in, I get an error in the console that says, "Token is not from a supported provider of this identity pool."当我尝试登录时,我在控制台中收到一条错误消息,提示“令牌不是来自此身份池的受支持提供者”。 using both form and console.使用表单和控制台。

I have tried the answers on other posts on stack overflow similar to this question.我已经尝试过关于堆栈溢出的其他帖子的答案,类似于这个问题。 The cause of my error is different than the causes in those other posts.我的错误的原因与其他帖子中的原因不同。

The Console View and the code below are both when I use the form version of the app.控制台视图和下面的代码都是当我使用应用程序的表单版本时。

Here is a screenshot of the form:这是表格的屏幕截图:

在此处输入图片说明

Here is what the console shows, without the details of the error:这是控制台显示的内容,没有错误的详细信息:

{"sub":"52c99df9-f7ef-42b2-9127-9675ba4e2414","email_verified":false,"iss":"https://cognito-idp.us-east-1.amazonaws.com/us-east-1_d0Y5gS66r ","phone_number_verified":true,"cognito:username":"*****","aud":"4feegfdtp0dbt9atu56vruuv37","event_id":"c77eff2c-01ad-42c3-8dac-a4849dc297c6","token_use":"id","auth_time":1560793958,"phone_number":"+***********","exp":1560797558,"iat":1560793958,"email":"********"} {"sub":"52c99df9-f7ef-42b2-9127-9675ba4e2414","email_verified":false,"iss":"https://cognito-idp.us-east-1.amazonaws.com/us-east- 1_d0Y5gS66r ","phone_number_verified":true,"cognito:username":"*****","aud":"4feegfdtp0dbt9atu56vruuv37","event_id":"c77eff2c-01ad-42c3-8dac-a4849" :"id","auth_time":1560793958,"phone_number":"+***********","exp":1560797558,"iat":1560793958,"email":"*** *****"}

User is authenticated:eyJraWQiOiJ4K1piekppSWN4RjZtbDVENjVSQXAySlBOQ0ROK2FmU3Fpc1BnSDE0c3ZvPSIsImFsZyI6IlJTMjU2In0..BqyjJJgOZcQP7yUDd3wDrrK4pNRs8BE8RvBzl2vIz248f3rgQ4fn1cd54azjtlplGkthbB0zA9xcd7gPJzqffd-3wS9RFevxkT4LfSiGF1UXGpIqHH_GhbMHA4dG6nKqBOmInvcn9gR1oblBszdbvUxE1poyP3MLvIi64vRvYm1P2kdikWlXl7qKH_RFivEmRMbpd4xpXH6Gjv3hxE6w2vn4O3oZkwz5eY-djUfbwy_uhItycPB3yZLGS8LU55vkrvyJrzHQLDu1U5AvkHGLZv1H7GveHm36RRwSGH5ZkCrtfkolRBN7wkqq9pGhh3jccqHN6Ml5L3XmH3irFNikfw用户进行身份验证:eyJraWQiOiJ4K1piekppSWN4RjZtbDVENjVSQXAySlBOQ0ROK2FmU3Fpc1BnSDE0c3ZvPSIsImFsZyI6IlJTMjU2In0..BqyjJJgOZcQP7yUDd3wDrrK4pNRs8BE8RvBzl2vIz248f3rgQ4fn1cd54azjtlplGkthbB0zA9xcd7gPJzqffd-3wS9RFevxkT4LfSiGF1UXGpIqHH_GhbMHA4dG6nKqBOmInvcn9gR1oblBszdbvUxE1poyP3MLvIi64vRvYm1P2kdikWlXl7qKH_RFivEmRMbpd4xpXH6Gjv3hxE6w2vn4O3oZkwz5eY-djUfbwy_uhItycPB3yZLGS8LU55vkrvyJrzHQLDu1U5AvkHGLZv1H7GveHm36RRwSGH5ZkCrtfkolRBN7wkqq9pGhh3jccqHN6Ml5L3XmH3irFNikfw

provider = cognito-idp.us-east-1.amazonaws.com/us-east-1_d0Y5gS66r提供者 = cognito-idp.us-east-1.amazonaws.com/us-east-1_d0Y5gS66r

Exception in thread "JavaFX Application Thread"线程“JavaFX 应用程序线程”中的异常

com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: com.amazonaws.services.cognitoidentity.model.NotAuthorizedException:

Token is not from a supported provider of this identity pool.令牌不是来自此身份池的受支持提供者。

(Service: AmazonCognitoIdentity; Status Code: 400; Error Code: (服务:AmazonCognitoIdentity;状态代码:400;错误代码:

NotAuthorizedException; NotAuthorizedException; Request ID:请求 ID:

b295ece8-9128-11e9-bb89-5d1e066e532b) b295ece8-9128-11e9-bb89-5d1e066e532b)

Here is the code for the sign in button that I press to sign in:这是我按下以登录的登录按钮的代码:

signin_button = new Button("Sign-In");
Label auth_message = new Label("");
signin_button.setOnAction((ActionEvent e) -> {
    String result = helper.ValidateUser(Username.getText(), Password.getText());
    if (result != null) {
        System.out.println("User is authenticated:" + result);
        auth_message.setText("User is authenticated");
        JSONObject payload = CognitoJWTParser.getPayload(result);
        String provider = payload.get("iss").toString().replace("https://", "");

        // Daniel Brower
        System.out.println("provider = " + provider);

        Credentials credentails = helper.GetCredentials(provider, result);


        ShowUserBuckets(credentails);
    } else {
        System.out.println("Username/password is invalid");
        auth_message.setText("Username/password is invalid");
    }

});

The line of code with my name in the comment above it is code I put in myself.上面注释中带有我名字的代码行是我自己输入的代码。

I'm having trouble figuring out from what provider the token is from.我无法弄清楚令牌来自哪个提供商。

Here is a screenshot of my identity providers page in Cognito Console.这是我在 Cognito 控制台中的身份提供商页面的屏幕截图。 I haven't selected any.我没有选择任何。 Nothing says that there is an identity provider.没有说有身份提供者。

在此处输入图片说明

The error message says "Service: AmazonCognitoIdentity" in it.错误消息中显示“服务:AmazonCognitoIdentity”。 I think the provider would be Cognito Identity Provider.我认为提供者将是 Cognito Identity Provider。 I even found classes with that name in it.我什至发现里面有这个名字的类。

I had the wrong value for some reason to Cognito Console->Federated Identities->Edit identity pool->Cognito->App client id由于某种原因,我对 Cognito Console->Federated Identities->Edit identity pool->Cognito->App client id 有错误的值

I don't know how I got it wrong.我不知道我怎么弄错了。 I changed it to match the correct one of the Identity Pool.我将其更改为匹配身份池中的正确之一。

This issue happens if your Federated Identity configuration is missing on your pool.如果您的池中缺少联合身份配置,则会出现此问题。

Open Federated Identities => Authentication providers

On the Cognito section change values as below在 Cognito 部分更改值如下

User Pool ID
ex: test:us-east-1_Ab129f000
App client id
ex: test:7lhlkkfbfb4q5kpp90urf000

That should be fix your issue那应该是解决你的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Java将用户注册到Amazon Cognito身份用户池 - How to register users to Amazon Cognito identity user pool by using Java 用户身份池使用Amazon Cognito对用户进行身份验证-Java SDK - User Identity Pool Authenticate user with Amazon Cognito - Java SDK Amazon Cognito:找不到身份 - Amazon cognito: identity not found Tomcat池未重置池。 连接过多错误 - tomcat pool not resetting the pool. Getting too many connections error 在AWS上运行Java程序(Amazon Web Services) - Running Java Program on AWS (Amazon Web Services) 在Android中处理AWS User Pool + Fedration Identity令牌刷新系统 - Handling AWS User Pool + Fedration Identity token refresh system in android 字符串生成器不使用字符串池中的字符串文字。 为什么? - String builder not using string literal from string pool. Why? 如何从Amazon Cognito代码/令牌获取主体 - How to get principal from Amazon Cognito code/token 如何配置 AWS 用户认知身份验证流程以在 Java sdk 后端生成身份令牌、访问令牌? - How to configure AWS user cognito authentication flow for generating identity token,access token in Java sdk backend? 从 AWS Credentials Provider 获取安全令牌 - Get security token from AWS Credentials Provider
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM