chrome.identity.launchWebAuthFlow unauthorized_client using



我正在尝试使用aws cognito作为非 Google 帐户身份验证来授权端点。

我正在尝试如下:

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。此外,我使用允许的 OAuth 范围设置aws.cognito.signin.user.admin Authorization code grant选项。

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

Token acquired:https://myid.chromiumapp.org/#error_description=unauthorized_client&state=STATE&error=invalid_request. See chrome://identity-internals for details.
  1. 在 URL 中,在配置Authorization code grant中请求response_type=token已启用。将response_type更改为code或启用Implicit grant
  2. 对于正确的重定向 URL,您可以使用chrome.identity.getRedirectURL()文档而不是手动构造

最新更新