shell - 使用 aws cli 命令在 AWS Cognito 中操作回调 URL
问题描述
我想在我的aws cognito
使用aws cli
命令(来自 shell 脚本)中修改现有的回调 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",]'
有什么帮助吗?
解决方案
这个有效。
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
推荐阅读
- electron - 使用电子打包器打包到.exe后如何禁用电子应用程序的http缓存
- android - Twilio:取消静音进入会议时已静音的参与者
- powershell - 使用 WinRM 在远程 Windows 服务器上运行 PowerShell 脚本
- javascript - Karma chrome 调试模式:浏览器中加载的重复 js 文件(带 & 不带 js 扩展名)
- firebase - 如何在flutter中实现oauth登录?
- javascript - 用于保存页面修改的 JavaScript 弹出窗口
- r-markdown - 如何在 Markdown knitr 中调整表格大小
- android - 如何在科尔多瓦触发地理围栏退出通知时发出警报
- c# - 如何在 C# 的即时窗口中的 Visual Studio 2017 中加载 SOS?
- r - 在r中绘制堆栈图