box-o-sand/youtube-api-poking/refresh-token

32 lines
603 B
Plaintext
Raw Normal View History

2016-12-31 04:16:01 +00:00
#!/usr/bin/env bash
set -o errexit
main() {
[[ "${OOM_YOUTUBE_ACCESS_TOKEN}" ]] || {
echo "Missing \$OOM_YOUTUBE_ACCESS_TOKEN"
exit 1
}
[[ "${OOM_CLIENT_SECRET}" ]] || {
echo "Missing \$OOM_CLIENT_SECRET"
exit 1
}
[[ "${OOM_CLIENT_ID}" ]] || {
echo "Missing \$OOM_CLIENT_ID"
exit 1
}
curl \
-vvvv \
-X POST \
-sSL \
-d client_id="${OOM_CLIENT_ID}" \
-d client_secret="${OOM_CLIENT_SECRET}" \
-d refresh_token="${OOM_YOUTUBE_ACCESS_TOKEN}" \
-d grant_type=refresh_token \
'https://accounts.google.com/o/oauth2/token'
}
main "$@"