Poking at the YouTube v3 API a bit
This commit is contained in:
33
youtube-api-poking/exchange-auth-code
Executable file
33
youtube-api-poking/exchange-auth-code
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o errexit
|
||||
|
||||
main() {
|
||||
local single_use_token="${1}"
|
||||
|
||||
[[ "${single_use_token}" ]] || {
|
||||
echo "Missing single use token arg"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ "${OOM_CLIENT_ID}" ]] || {
|
||||
echo "Missing \$OOM_CLIENT_ID"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ "${OOM_CLIENT_SECRET}" ]] || {
|
||||
echo "Missing \$OOM_CLIENT_SECRET"
|
||||
exit 1
|
||||
}
|
||||
|
||||
curl \
|
||||
-X POST \
|
||||
-sSL \
|
||||
-d "client_id=${OOM_CLIENT_ID}" \
|
||||
-d "code=${single_use_token}" \
|
||||
-d "client_secret=${OOM_CLIENT_SECRET}" \
|
||||
-d 'redirect_uri=urn:ietf:wg:oauth:2.0:oob' \
|
||||
-d 'grant_type=authorization_code' \
|
||||
'https://accounts.google.com/o/oauth2/token'
|
||||
}
|
||||
|
||||
main "$@"
|
Reference in New Issue
Block a user