https://github.com/dstreet/goauth-cli
Dead-simple Google OAuth v2 login for the command line.
https://github.com/dstreet/goauth-cli
cli google google-api oauth2
Last synced: 2 months ago
JSON representation
Dead-simple Google OAuth v2 login for the command line.
- Host: GitHub
- URL: https://github.com/dstreet/goauth-cli
- Owner: dstreet
- License: apache-2.0
- Created: 2019-06-18T15:27:51.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T01:26:47.000Z (over 3 years ago)
- Last Synced: 2025-01-16T11:58:58.041Z (over 1 year ago)
- Topics: cli, google, google-api, oauth2
- Language: TypeScript
- Size: 62.5 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goauth-cli
Dead-simple Google OAuth v2 login for the command line.
Goole OAuth v2 requires that users authenticate with Google via a web interface
provided by Google. This tool implements all the steps necessary to get
the refresh and access tokens in order to interact with the Google APIs from
the command line.
`goauth-cli` generates the login url and immediately opens a web browser to the
correct url. It also starts a temporary webserver to capture the authorization
code sent back by Google. Once the login process is complete, the webserver is
shutdown.
## Install
```
$ npm i goauth-cli
```
## Usage
```js
import { GoauthCli } from 'goauth-cli'
const auth = new GoauthCli(CLIENT_ID, CLIENT_SECRET, SCOPES)
const authClient = await auth.login()
```
## Login options
- `callbackport`: The port that the webserver will listen on. Defaults to a
random, available port
- `callbackPath`: The callback url path. Defaults to `/oauth-callback`.
## License
[Apache License Vesion 2.0](./LICENSE)