https://github.com/x-color/google-oauth-cli
It is a tool to be authorized with OAuth 2.0(Authorization Code Flow with Proof Key for Code Exchange) and access Google API.
https://github.com/x-color/google-oauth-cli
cli golang google oauth2
Last synced: 5 months ago
JSON representation
It is a tool to be authorized with OAuth 2.0(Authorization Code Flow with Proof Key for Code Exchange) and access Google API.
- Host: GitHub
- URL: https://github.com/x-color/google-oauth-cli
- Owner: x-color
- License: mit
- Created: 2022-07-02T07:04:05.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-07T11:27:30.000Z (almost 4 years ago)
- Last Synced: 2024-06-21T12:54:36.436Z (about 2 years ago)
- Topics: cli, golang, google, oauth2
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google OAuth CLI
It is a tool to be authorized with OAuth 2.0(Authorization Code Flow with Proof Key for Code Exchange) and access Google API.
Read [this blog](https://zenn.dev/x_color/articles/google-oauth-cli) for details.
## Usage
Before using the cli, you must prepare Google OAuth Client settings. See https://developers.google.com/identity/protocols/oauth2/native-app#prerequisites.
Install the cli
```
$ go install github.com/x-color/google-oauth-cli@latest
$ google-oauth-cli
This command has login, logout, email commands. Please use them.
```
Set environment variables
```
$ export CLIENT_ID=
$ export CLIENT_SECRET=
```
Authorize the cli with OAuth
```
$ google-oauth-cli login
```
Get your google account's mail address
```
$ google-oauth-cli email
Your email address is
```
Remove a token
```
$ google-oauth-cli logout
```