Skip to content

Instantly share code, notes, and snippets.

@timmyw
Created September 30, 2016 00:58
Show Gist options
  • Save timmyw/1f932fabc3471989a645121e9ef0a72e to your computer and use it in GitHub Desktop.
Save timmyw/1f932fabc3471989a645121e9ef0a72e to your computer and use it in GitHub Desktop.
auth then playout
#!/bin/sh
[email protected]
pass=timmytest1
# Assumes vimond-api-proxy is running locally on port 8001
apiproxyhost=http://localhost:8001
assetid=1667
echo "Authenticating..."
curl -s -o /tmp/authprog -D /tmp/authheaders -H "Accept: application/json" --data "[email protected]&password=timmytest1" http://sit1-play.iflix.com/api/authentication/user/login
grep -q x-vimond-playout-access-token /tmp/authheaders
if [ $? -ne 0 ]; then
echo "Authorisation failed. Check /tmp/authheaders"
exit 2
fi
token=$(grep x-vimond-playout-access-token /tmp/authheaders |
sed -e 's/.*token: \(.*\)/\1/' -e 's/\r$//')
echo "Using token: $token"
echo curl -H "'Authorization: $token'" -H \'Accept:application/json\' $apiproxyhost/layer/playout/web/asset/$assetid > /tmp/runplay
cat /tmp/runplay
sh /tmp/runplay
rm /tmp/authheaders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment