Skip to main content

I have followed the sample script for using Control Hub REST APIs below. However, I receive this error message 

 

cat: cookie.txt: No such file or directory

{"message":"Authentication succeeded"} Generated session token : 

 

curl -X POST -d '{"userName":"xxx", "password": "xxx"}' https://cloud.streamsets.com/security/public-rest/v1/authentication/login --header "Content-Type:application/json" --header "X-Requested-By:SCH" -c cookie.txt


sessionToken=$(cat cookie.txt | grep SSO | rev | grep -o '^\S*' | rev)

echo "Generated session token : $sessionToken"

 

Can someone help ? What should I do 

@siang14501 

Where did you run the curl command? did you get a successful execution?


@saleempothiwala I run it at the stop events ( shell ). I did get a successful execution for my pipeline


Hi @siang14501 ,

Have you tried running the script on your linux prompt and see if it generates cookie.txt.

It could be possible that when you run the script from within StreamSets then the sdc user does not have permission to create the file. Try something like this:

 

curl -X POST -d '{"userName":"xxx", "password": "xxx"}' https://cloud.streamsets.com/security/public-rest/v1/authentication/login --header "Content-Type:application/json" --header "X-Requested-By:SCH" -c /tmp/cookie.txt

sessionToken=$(cat /tmp/cookie.txt | grep SSO | rev | grep -o '^\S*' | rev)

Reply