Generate Google OAuth2 Credential file for batch program.
First, create API project from Google API Console if haven't create it. And then turn on API that you want to use.
Create OAuth client and get client secret from Google Cloud Console.
- Go to Google Cloud Console
- Click API Manager
- Click Create Credentials
- Click Create OAuth Client ID
- Choose Other
- Fill Application name
- Get the client id and client secret
- Download client secret JSON from download button
then download client secret file. (this file path for -secret
option)
After saving client secret you run ggoc
as follow:
$ ggoc -secret CLIENT_SECRET_PATH \
-credential CREDENTIAL_OUTPUT_PATH \
-scope GOOGLE_OAUTH_SCOPE
The candidate of GOOGLE_OAUTH_SCOPE
is listed here.
OAuth authorization requires
- 'Go to the following link in your browser then type the authorization code' log and Authorization URL display on console
- Copy and paste authorization URL on browser address bar
- OAuth token displays if authorization success.
- Copy and paste OAuth token to console and hit enter key
After those procedure, you can get credential file detected -credential
option.
If you are macOS user, you can install via Homebrew.
$ brew tap noissefnoc/homebrew-ggoc
$ brew install ggoc
Other OS users can download binary from release page.
And you can also use go get
$ go get -u github.com/noissefnoc/ggoc
MIT