Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GCP Authenticator Script
#!/bin/bash
echo -n "Client ID: "
read client_id
echo -n "Client secret: "
read client_secret
echo -n "Redirect URI: "
read redirect_uri
open "https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=$client_id&redirect_uri=$redirect_uri&access_type=offline&scope=https://www.googleapis.com/auth/cloudprint"
echo -n "Authorization code (from browser): "
read authorization_code
curl -d "code=$authorization_code&client_id=$client_id&client_secret=$client_secret&redirect_uri=$redirect_uri&grant_type=authorization_code" https://accounts.google.com/o/oauth2/token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment