acme-dns-01-googlecloud.js/oauth2l-test-token.sh

18 lines
673 B
Bash
Raw Normal View History

2019-07-23 07:12:46 +00:00
#!/bin/bash
# If your service_account.json is correct you should definitely be able to get a token
# using Google's official tool. If this fails, it will definitely fail with our own.
set -e
export GOOGLE_APPLICATION_CREDENTIALS=$HOME/Downloads/service_account.json
project=example-change-me
token=$(oauth2l fetch ndev.clouddns.readwrite)
echo $token
curl -fL "https://www.googleapis.com/dns/v1/projects/$project/managedZones" -H "Authorization: Bearer $token"
token=$(oauth2l fetch --jwt https://www.googleapis.com/auth/ndev.clouddns.readwrite)
echo $token
curl -fL "https://www.googleapis.com/dns/v1/projects/$project/managedZones" -H "Authorization: Bearer $token"