oauth_tokengen
is a command line tool to obtain OAuth2 tokens for different providers using a local callback server. It is written in golang and uses oauth2 package for OAuth2 implementation.
All the heavy lifting is done by the package oauth2.
If you have any question, request or suggestion, please enter it in the Issues with appropriate label.
go install github.com/muquit/oauth_tokengen@latest
Or build from source:
git clone https://github.com/muquit/oauth_tokengen.git
cd oauth_tokengen
go build
# Using flags
./oauth_tokengen \
--client-id="your-client-id" \
--client-secret="your-client-secret" \
--auth-url="https://api.login.yahoo.com/oauth2/request_auth" \
--token-url="https://api.login.yahoo.com/oauth2/get_token" \
--scopes="mail-w"
# Using environment variables
export OAUTH_CLIENT_ID="your-client-id"
export OAUTH_CLIENT_SECRET="your-client-secret"
./oauth_tokengen \
--auth-url="https://api.login.yahoo.com/oauth2/request_auth" \
--token-url="https://api.login.yahoo.com/oauth2/get_token" \
--scopes="mail-w"
# Using flags
./oauth_tokengen \
--client-id="your-client-id" \
--client-secret="your-client-secret" \
--auth-url="https://accounts.google.com/o/oauth2/v2/auth" \
--token-url="https://oauth2.googleapis.com/token" \
--scopes="https://mail.google.com/"
# Using environment variables
export OAUTH_CLIENT_ID="your-client-id"
export OAUTH_CLIENT_SECRET="your-client-secret"
./oauth_tokengen \
--auth-url="https://accounts.google.com/o/oauth2/v2/auth" \
--token-url="https://oauth2.googleapis.com/token" \
--scopes="https://mail.google.com/"
Required (can be provided via flags or environment variables):
--client-id
- OAuth2 client ID (orOAUTH_CLIENT_ID
env var)--client-secret
- OAuth2 client secret (orOAUTH_CLIENT_SECRET
env var)--auth-url
- Authorization URL--token-url
- Token URL--scopes
- Comma-separated list of scopes
Optional:
--redirect-url
- Redirect URL (default: "http://localhost:8080/callback")--port
- Local server port (default: 8080)
- Auth URL:
https://accounts.google.com/o/oauth2/v2/auth
- Token URL:
https://oauth2.googleapis.com/token
- Auth URL:
https://api.login.yahoo.com/oauth2/request_auth
- Token URL:
https://api.login.yahoo.com/oauth2/get_token
- Auth URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
- Token URL:
https://login.microsoftonline.com/common/oauth2/v2.0/token
Claude AI 3.5 Sonnet with instructions from muquit@muquit.com