0

I want to modify the existing callback url in my aws cognito using aws cli command (From shell script).

Below command i am using to describe the user-pool client.

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

Now i want to check that my url is available in callback url or not. If not then add this url in callback url.

I can achieve this using below command.

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

But i don't know how to manipulate the existing callback url in shell script.

And should give every parameter while updating the user-pool-client?

I tried to update the callback-url using below command and my remaining all settings get removed.

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",]'

Any help?

Jayesh Dhandha
  • 1,983
  • 28
  • 50

1 Answers1

0

This one works.

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
iGian
  • 11,023
  • 3
  • 21
  • 36
  • 4
    Have you checked other values of this user-pool-client? We have to pass all other existing values as well. Otherwise, it will get removed and we will see only the callback urls. – Jayesh Dhandha Jun 13 '18 at 13:13