【问题标题】:Use the token response from SAML authentication with User Pools to retrieve AWS Temporary Access keys使用来自 SAML 身份验证的令牌响应和用户池来检索 AWS 临时访问密钥
【发布时间】:2018-12-08 21:16:44
【问题描述】:

如何使用来自用户池的 SAML 身份验证的令牌响应来检索 AWS 临时访问密钥并进行 API 网关调用?

我已经配置了一个带有关联应用客户端的 Cognito 用户池。我已将 Okta 配置为第 3 方 SAML 身份提供程序。使用 Amazon 托管的登录 https://[cognito domain name]/login?response_type=token&client_id=[your App client id]&redirect_uri=[your App client redirect URL] 我可以重定向到我的 ReactJS 应用程序,并在标题中使用 #access_token

我现在正在尝试使用#access_token 来调用 API 网关。我一直在关注这个guide 以及 aws-amplify。据我了解,我需要使用 #access_token 来获取 AWS 访问密钥以调用 API 网关。

我正在尝试使用以下代码:

AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-east-1:xxxxxxx-xxxx-xxxx-xxxx-xxxxxx',
   Logins: {
      'cognito-idp.us-east-1.amazonaws.com/us-east-1_xxxxxx': #access_token
   }
});

但不确定它如何与 aws-amplify 集成,并且我还没有成功检索 AWS 临时访问密钥以进行 API Gateway 调用。

我以前使用 Cognito 用户池中的用户进行此工作,但现在我需要将 Okta 作为身份提供者包括在内。

【问题讨论】:

    标签: amazon-web-services aws-api-gateway amazon-cognito aws-amplify aws-userpools


    【解决方案1】:

    我发现我需要#id_token 而不是#access_token 来完成我想做的事情。我通过在我的 Cognito 池应用程序客户端设置中选择以下选项启用了 #id_token

    然后我可以关注Cognito hosted UI

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-11
      • 2017-09-28
      • 2020-01-26
      • 2016-06-10
      • 1970-01-01
      • 2015-09-01
      相关资源
      最近更新 更多