Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxcnunes/tokenizer
Generates oauth2 tokens
https://github.com/maxcnunes/tokenizer
Last synced: about 2 months ago
JSON representation
Generates oauth2 tokens
- Host: GitHub
- URL: https://github.com/maxcnunes/tokenizer
- Owner: maxcnunes
- Created: 2015-01-20T21:50:04.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-28T17:58:22.000Z (over 8 years ago)
- Last Synced: 2024-10-18T07:23:14.433Z (3 months ago)
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tokenizer
Generates oauth2 tokens
Working with micro services and oauth2 authentications can cause such hard work generating new access tokens for different clients and generating new tokens when the previous one has expired. Due that I created this tool to help generating new tokens.
## Install
### From binary
[Releases](https://github.com/maxcnunes/tokenizer/releases)
**Example installing version 1.0.0 on Linux 64**
```bash
sudo wget -q -O /usr/local/bin/tokenizer https://github.com/maxcnunes/tokenizer/releases/download/v1.0.1/tokenizer-linux_amd64 \
&& sudo chmod +x /usr/local/bin/tokenizer
```### With Go
```bash
go get -u github.com/maxcnunes/tokenizer
```## Configuration
Configuration file **.tokenizer.json** must be located in HOME directory:
```json
{
"OAuth2Services": [
{
"name": "client1",
"url": "http://oauth2-service.example/authentication-route",
"grantType": "client_credentials",
"clientId": "1",
"clientSecret": "xxxxxxxxxxxx"
},
{
"name": "client2",
"url": "http://oauth2-service.example/authentication-route",
"grantType": "client_credentials",
"clientId": "2",
"clientSecret": "xxxxxxxxxxxx"
}
]
}
```## Usage
```bash
$GOPATH/bin/tokenizer
```## Example
### Select options
```bash
» $GOPATH/bin/tokenizer
Select the oauth2 service:
> client1
> client2
>>> client1
{
"access_token": "947115cd41ae4e9597a4f1d93b9415d5",
"expires_in": 3600,
"refresh_token": "x7d00ce9b2874c11903da50cf6cabdf1",
"token_type": "bearer"
}%
```### Single command
```bash
» $GOPATH/bin/tokenizer -name client1
{
"access_token": "947115cd41ae4e9597a4f1d93b9415d5",
"expires_in": 3600,
"refresh_token": "x7d00ce9b2874c11903da50cf6cabdf1",
"token_type": "bearer"
}%
```## Build
Using [goxc](https://github.com/laher/goxc).
```bash
goxc
```