【问题标题】:chrome.identity.launchWebAuthFlow unauthorized_client using aws cognitochrome.identity.launchWebAuthFlow 未授权客户端使用 aws cognito
【发布时间】:2019-10-15 02:54:43
【问题描述】:

我正在尝试使用aws cognito 作为Non-Google account authentication 来授权端点。

我正在尝试如下:

chrome.identity.launchWebAuthFlow(         
      {'url': 'https://mydomain.auth.eu-west-1.amazoncognito.com/oauth2/authorize?response_type=token&client_id=myapplicationclientid&redirect_uri=https://myid.chromiumapp.org/&state=STATE&scope=aws.cognito.signin.user.admin', 'interactive': true},
      function(redirect_url) {
        if (chrome.runtime.lastError) {
          sampleSupport.log(chrome.runtime.lastError);
          changeState(STATE_START);
        } else {
          //sampleSupport.log(chrome.identity.getRedirectURL());
          sampleSupport.log('Token acquired:'+redirect_url+
            '. See chrome://identity-internals for details.');
          changeState(STATE_AUTHTOKEN_ACQUIRED);
        }

      });

在 aws amazon cognito 应用程序配置菜单中,我将回调 URL 设置如下:https://myid.chromiumapp.org/provider_cb。另外,我将Authorization code grant 选项设置为aws.cognito.signin.user.admin 允许的OAuth 范围。

我不知道我做错了什么,但我收到以下错误:

Token acquired:https://myid.chromiumapp.org/#error_description=unauthorized_client&state=STATE&error=invalid_request. See chrome://identity-internals for details.

【问题讨论】:

    标签: amazon-web-services authentication oauth-2.0 amazon-cognito google-oauth


    【解决方案1】:
    1. 在 URL 中请求 response_type=token,而在配置中启用 Authorization code grant。将response_type 更改为code 或启用Implicit grant
    2. 对于正确的重定向 URL,您可以使用 chrome.identity.getRedirectURL() docs 而不是手动构造

    【讨论】:

      猜你喜欢
      • 2017-07-06
      • 1970-01-01
      • 1970-01-01
      • 2018-12-01
      • 2021-04-21
      • 2017-10-16
      • 2019-04-27
      • 2021-09-23
      • 2020-05-13
      相关资源
      最近更新 更多