Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/prembhaskal/parse-jwt-token
- Owner: prembhaskal
- License: mit
- Created: 2021-08-19T13:29:45.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-06T07:37:35.000Z (about 3 years ago)
- Last Synced: 2024-06-20T13:31:21.509Z (5 months ago)
- Language: Go
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```