【问题标题】:Manipulate Callback URL in AWS Cognito using aws cli command使用 aws cli 命令在 AWS Cognito 中操作回调 URL
【发布时间】:2018-11-04 12:34:25
【问题描述】:

我想使用 aws cli 命令(来自 shell 脚本)修改我的 aws cognito 中现有的回调 url。

下面的命令我用来描述用户池客户端。

aws cognito-idp describe-user-pool-client --user-pool-id us-west-2_asASD24d --client-id asdfasdf546a5s4df --region us-west-2

现在我想检查我的 url 在回调 url 中是否可用。如果没有,则将此 url 添加到回调 url 中。

我可以使用下面的命令来实现这一点。

aws cognito-idp describe-user-pool-client --user-pool-id us-west-2_asASD24d --client-id asdfasdf546a5s4df --region us-west-2 --callback-urls <value>

但我不知道如何在 shell 脚本中操作现有的回调 url。

并且应该在更新用户池客户端时给出每个参数?

我尝试使用以下命令更新回调 URL,而我剩余的所有设置都被删除。

aws cognito-idp update-user-pool-client --user-pool-id us-west-2_peANXssz7 --client-id 22d80r9fh1oh80i5pc5vuc63br --region us-west-2 --callback-urls '["https://test-jdtest.dev.com?oauth=callback",]'

有什么帮助吗?

【问题讨论】:

    标签: shell aws-cli aws-cognito aws-userpools


    【解决方案1】:

    这个有效。

    ExistingCallbackUrls=$(aws cognito-idp describe-user-pool-client --user-pool-id $CognitoPoolId --client-id $CognitoClientId --region $AWS_REGION --output text | grep CALLBACKURLS | awk '{print $2}')
    
    YourUrl=https://example.com
    
    NewCallbackUrls="$ExistingCallbackUrls $YourUrl"
    
    aws cognito-idp update-user-pool-client --user-pool-id $CognitoPoolId --client-id $CognitoClientId --callback-urls $NewCallbackUrls --region $AWS_REGION
    

    【讨论】:

    • 你检查过这个用户池客户端的其他值吗?我们还必须传递所有其他现有值。否则,它将被删除,我们只会看到回调 url。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-24
    • 2023-01-24
    • 1970-01-01
    • 1970-01-01
    • 2017-05-29
    • 2017-06-14
    相关资源
    最近更新 更多