gpt4 book ai didi

amazon-web-services - 将 Google Login 与 Cognito 和 API Gateway 集成

转载 作者:行者123 更新时间:2023-12-04 08:01:45 31 4
gpt4 key购买 nike

我希望整合 Google Login (不是 Cognito 提供的 Google+,我不想要求用户成为 Google+ 用户)与 Cognito 和 API 网关。

我走在正确的轨道上吗?

  • 我已将 account.google.com 添加到 Cognito 的联合身份池
  • 登录后:

    AWS.config.region = "ap-northeast-2"
    AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'ap-northeast-2:31cc246c-bd2e-46ee-91da-2b8eefcf0745',
    Logins: {
    "accounts.google.com": googleUser.getAuthResponse().id_token
    }
    })

到目前为止,我走在正确的轨道上吗?但是仅凭这一点我就没有认知 token 吗?

我想我需要遵循来自 the docs 的流程之一.但是哪个?

我只使用增强版(简体版)吗?并调用 GetIdGetCredentialsForIdentity?但是我什至需要 GetId。我想我只需要一个 token ?

有任何示例或指南吗?我不想只是暴力破解任何有用的东西,但不了解每个流程的用例是什么......有人可以帮忙解释一下吗?

最佳答案

通过配置 AWS.config.credentials,您可以有效地配置用于自动获取 AWS 访问 key ID 和 secret 访问 key 的凭证对象。

CognitoIdentityCredentials ( see here ) 对象会在您尝试调用任何其他 AWS 库(例如 S3)时为您建立这些。如果您需要访问 key 本身,请调用 AWS.config.credentials.refresh() ( refresh ) 或 AWS.config.credentials.get() 和在回调中,您可以访问 AWS.config.credentials.secretAccessKey ( secretAccessKey ) 等。

最后,如果您希望使用联合身份获取 Open ID token ,以便以与 Cognito 用户池类似的方式使用——据我所知,这目前是不可能的。您可以获得的最接近的是 GetOpenIdToken .

关于amazon-web-services - 将 Google Login 与 Cognito 和 API Gateway 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44083262/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com