Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/prembhaskal/parse-jwt-token

library to parse a JWT token
https://github.com/prembhaskal/parse-jwt-token

Last synced: about 14 hours ago
JSON representation

library to parse a JWT token

Awesome Lists containing this project

README

        

# parse-jwt-token
library to parse a JWT token.
Do note that current method only reads token without validating it.

### steps to install
1. install from source package
```bash
$ go get github.com/prembhaskal/parse-jwt-token
```
2. install from binary
coming soon...

### how to use
The library reads from standard input and put the parsed jwt content on standard output.
1. read from stdin.
```bash
$ echo "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ." | parse-jwt-token
{
"iat": 1516239022,
"name": "John Doe",
"sub": "1234567890"
}

```

2. read from variable.
```bash
$ export rawtoken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ."
$ echo $rawtoken | parse-jwt-token
```

3. read from file
```bash
$ echo "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ." > /tmp/token.txt

$ cat /tmp/token.txt | parse-jwt-token

OR

$ parse-jwt-token < /tmp/token.txt

```