gpt4 book ai didi

amazon-web-services - AWS + Serverless - 如何获取cognito用户池生成的 key

转载 作者:行者123 更新时间:2023-12-03 16:04:09 24 4
gpt4 key购买 nike

我一直在关注 https://serverless-stack.com/chapters/configure-cognito-user-pool-in-serverless.html 上的无服务器教程。

我有以下无服务器 yaml 片段

Resources:
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
# Generate a name based on the stage
UserPoolName: ${self:custom.stage}-moochless-user-pool
# Set email as an alias
UsernameAttributes:
- email
AutoVerifiedAttributes:
- email

CognitoUserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
# Generate an app client name based on the stage
ClientName: ${self:custom.stage}-user-pool-client
UserPoolId:
Ref: CognitoUserPool
ExplicitAuthFlows:
- ADMIN_NO_SRP_AUTH
# >>>>> HOW DO I GET THIS VALUE IN OUTPUT <<<<<
GenerateSecret: true

# Print out the Id of the User Pool that is created
Outputs:
UserPoolId:
Value:
Ref: CognitoUserPool

UserPoolClientId:
Value:
Ref: CognitoUserPoolClient
#UserPoolSecret:
# WHAT GOES HERE?

我正在将所有其他配置变量导出到 json 文件(由移动应用程序使用,因此我需要 key )。

如何让生成的 key 出现在我的输出列表中?

最佳答案

检索 key 的理想方法是在 cloudformation 模板中使用“CognitoUserPoolClient.ClientSecret”。

UserPoolClientIdSecret:
Value:
!GetAtt CognitoUserPoolClient.ClientSecret

但按照解释,它不受支持 here并给出如图所示的消息:Not supported您可以运行以下 CLI 命令来检索 key 作为解决方法:

aws cognito-idp describe-user-pool-client --user-pool-id "us-west-XXXXXX"  --region us-west-2 --client-id "XXXXXXXXXXXXX" --query 'UserPoolClient.ClientSecret' --output text

关于amazon-web-services - AWS + Serverless - 如何获取cognito用户池生成的 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53967724/

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