@@ -45,7 +45,6 @@ import (
4545
4646 " github.com/auth0/go-jwt-middleware/v2"
4747 " github.com/auth0/go-jwt-middleware/v2/validator"
48- jwtmiddleware " github.com/auth0/go-jwt-middleware/v2"
4948)
5049
5150var handler = http.HandlerFunc (func (w http.ResponseWriter , r *http.Request ) {
@@ -68,7 +67,7 @@ var handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
6867func main () {
6968 keyFunc := func (ctx context.Context ) (interface {}, error ) {
7069 // Our token must be signed using this data.
71- return []byte (" secret " ), nil
70+ return []byte (" abcdefghijklmnopqrstuvwxyz012345 " ), nil
7271 }
7372
7473 // Set up the validator.
@@ -92,7 +91,7 @@ func main() {
9291After running that code (` go run main.go ` ) you can then curl the http server from another terminal:
9392
9493```
95- $ curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiZ28tand0LW1pZGRsZXdhcmUtZXhhbXBsZSJ9.xcnkyPYu_b3qm2yeYuEgr5R5M5t4pN9s04U1ya53-KM " localhost:3000
94+ $ curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiZ28tand0LW1pZGRsZXdhcmUtZXhhbXBsZSJ9.Wkxc3JFClh8CVeGpZlsW4vhlcvCQpyTGkL8ezcp-V-A " localhost:3000
9695```
9796
9897That should give you the following response:
@@ -109,7 +108,7 @@ That should give you the following response:
109108}
110109```
111110
112- The JWT included in the Authorization header above is signed with ` secret ` .
111+ The JWT included in the Authorization header above is signed with ` abcdefghijklmnopqrstuvwxyz012345 ` .
113112
114113To test how the response would look like with an invalid token:
115114
0 commit comments