Skip to content

Get Google OAuth2 Credential file for batch program.

License

Notifications You must be signed in to change notification settings

noissefnoc/ggoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ggoc

GitHub release MIT License Go Report Card

Generate Google OAuth2 Credential file for batch program.

Usage

Turn on API

First, create API project from Google API Console if haven't create it. And then turn on API that you want to use.

Get client secret from Google Cloud Platform

Create OAuth client and get client secret from Google Cloud Console.

  1. Go to Google Cloud Console
  2. Click API Manager
  3. Click Create Credentials
    1. Click Create OAuth Client ID
    2. Choose Other
    3. Fill Application name
  4. Get the client id and client secret
    1. Download client secret JSON from download button

then download client secret file. (this file path for -secret option)

Run command

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.

Get OAuth token from browser

OAuth authorization requires

  1. 'Go to the following link in your browser then type the authorization code' log and Authorization URL display on console
  2. Copy and paste authorization URL on browser address bar
  3. OAuth token displays if authorization success.
  4. Copy and paste OAuth token to console and hit enter key

After those procedure, you can get credential file detected -credential option.

Install

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

License

MIT

Author

Kota Saito

About

Get Google OAuth2 Credential file for batch program.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published