|Jwt + Golang For Secured Api|
For jwt authnetication i am using the dgrijalva/jwt-go package with my golang project.
First of all fetch packge from repository
go get github.com/dgrijalva/jwt-go
Now you are ready to use the jwt
I am sharing here my basic code to create secure routes using jwt
Here you can see that we have used jwtcheck function as middleware. It processes the request before passing it forward. If request has a valid jwt token than that request get forwarded to the intended function otherwise that request does not forwarded.
Hope you find it usefull. If you have any question just ask in comments.