Simple JWT Server made to understand how JWT works.
By https://github.com/mmalessa
Inspired by https://github.com/sohamkamani/jwt-go-example
In a production environment, use it only at your own risk!
go get github.com/mmalessa/jwt-test-server
go install github.com/mmalessa/jwt-test-server
~/go/bin/jwt-test-server /path/to/config/file.yaml
All you need is in config.yaml
jwt:
key: mySecretKey
expirationtime: 30 # in minutes
server:
port: 8000
credentials:
user1: password1
user2: password2
{
"username":"myUsername",
"password":"myHiddenPassword"
}
200: application/json
{
"token": "eyJhbGciOiJ*********Tw"
}
Authorization: "Bearer eyJhbGciOiJ*********Tw"
200: application/json
{
"token": "eyJhbGciOiJ*********Tw"
}
Authorization: "Bearer >JWT Token string<
200: application/json
{
"username": "test",
"exp": 1561991616
}
400, 401, 500: application/json
{
"Code": "500",
"Message": "Internal Server Error"
}