All Projects → sohamkamani → jwt-go-example

sohamkamani / jwt-go-example

Licence: other
Example application that implements JWT based authentication

Programming Languages

go
31211 projects - #10 most used programming language

JWT Go example

Example application that implements JWT based authentication. Read the blog post here

To run this application, build and run the Go binary:

go build
./jwt-go-example

Now, using any HTTP client with support for cookies (like Postman, or your web browser) make a sign-in request with the appropriate credentials:

POST http://localhost:8000/signin

{"username":"user1","password":"password1"}

You can now try hitting the welcome route from the same client to get the welcome message:

GET http://localhost:8000/welcome

Hit the refresh route, and then inspect the clients cookies to see the new value of the token cookie:

POST http://localhost:8000/refresh

You can find the working source code for this example here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].