https://github.com/potatogopher/jwt-go-example
JWT example using Go from WilliamKennedy's Youtube page.
https://github.com/potatogopher/jwt-go-example
Last synced: 12 months ago
JSON representation
JWT example using Go from WilliamKennedy's Youtube page.
- Host: GitHub
- URL: https://github.com/potatogopher/jwt-go-example
- Owner: potatogopher
- Created: 2016-04-19T19:18:27.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-19T23:35:27.000Z (about 10 years ago)
- Last Synced: 2025-04-14T23:15:30.326Z (about 1 year ago)
- Language: Go
- Homepage: https://www.youtube.com/watch?v=eVlxuST7dCA
- Size: 1.95 KB
- Stars: 2
- Watchers: 0
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JWT Go Example
I put this repo together so there would be something up for the [video][2] showing a JWT example using Go from [WilliamKennedy's][1] Youtube page.
The presenter is using the following resources to authenticate with JWTs:
- [dgrijalva/jwt-go][5]
- [codegangsta/negroni][3]
- [gorilla/mux][4]
## Set Up
```
$ git clone git@github.com:nicholasrucci/jwt-go-example.git
$ cd jwt-go-example
```
## Create Private & Public Keys
```
$ openssl genrsa -out demo.rsa
$ openssl rsa -in demo.rsa -pubout > demo.rsa.pub
```
## Test
```js
$ curl localhost:3000/login
// returns JWT
$ curl -H "Authorization: Bearer " localhost:3000/api
// if valid: returns Success
// else: error
```
[1]: https://www.youtube.com/channel/UCD15RoW4ySsIE1YrQmspeeg
[2]: https://www.youtube.com/watch?v=eVlxuST7dCA
[3]: https://github.com/codegangsta/negroni
[4]: https://github.com/gorilla/mux
[5]: https://github.com/dgrijalva/jwt-go