【问题标题】:Sending AWS Cognitio Credentials with a GET request without using a SDK在不使用开发工具包的情况下通过 GET 请求发送 AWS Cognitio 凭证
【发布时间】:2016-11-08 02:14:08
【问题描述】:

对于 React-Native 应用程序,我想通过 GET 请求向我的 API 发送 Cognito 凭据。我遵循以下方法[1]:

Cognito 用户池 + Cognito 身份池 + API 网关 + AWS_IAM 授权 + Cognito 凭证

在当前阶段,我可以收到相关角色的 Cognito 凭据,如此处所述 [2] 现在,我想使用这些凭据来访问我的 API。我已在我的 API 网关中将授权类型设置为 AWS_IAM。 但我不知道如何通过我的 GET 请求发送我的 Cognito 凭据。我已经浏览了这些文件,但它似乎只解释了不同的 SDK。

let response = await fetch('https://12345.execute-api.us-east-1.amazonaws.com/dev/single', {
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
          // What to do here??
        },

我可以查看任何指针和/或文档吗?

[1]https://forums.aws.amazon.com/thread.jspa?threadID=230452

[2]http://mobile.awsblog.com/post/TxGNH1AUKDRZDH/Announcing-Your-User-Pool-in-Amazon-Cognito

【问题讨论】:

标签: amazon-web-services amazon-cognito aws-api-gateway aws-lambda


【解决方案1】:

我不完全理解您将 Cognito 凭证发送到 API Gateway 的意思,但如果您想使用从 Cognito 获得的凭证,您需要使用该凭证到 sign the request 到 API Gateway。

我建议您可以使用 AWS react native SDK 中的签名者来签署请求或一些 3rd 方库,如 react-native-aws-signature

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-03-23
    • 1970-01-01
    • 1970-01-01
    • 2017-05-14
    • 2015-08-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多