Google-tokens
Tool for getting Google Cloud API OAuth tokens (refresh token)
Why?
- To simplify getting OAuth tokens
- As a alternative to OAuth Playground
- OAuth2 for Web Server Applications
Getting started
- Sign-up for a Google Cloud API account.
- Create an API project with an OAuth client id and add a 'Authorized redirect URI' of
http://localhost:3000/callback
. - Obtain your
client_id
&client_secret
from the credentials JSON file from the console
.gtokens.json
Steps to generate git clone https://github.com/bradoyler/google-tokens.git
- copy .gtokens.example.json to .gtokens.json
- fill in
client_id
andclient_secret
- install & run
npm install
npm start
- follow prompt and copy
refresh_token
to your '.gtokens.json'
API
const GoogleTokens = const tokens = client_id client_secret // OAuth credentials const scope = 'https://www.googleapis.com/auth/drive' 'https://www.googleapis.com/auth/drive.readonly' tokens // required to pass API scope
refresh_token
the first-time you authenticate, but you can force to get new tokens by using the 'prompt' option, like so:
NOTE: you will only get a tokens
TODOs:
- add CLI support
- allow for using shortnames (ie.
auth/drive
) in scope - tests for all options