title: illegal base64 data at input byte 0 in go
body: <p>I am starting with go and jwt. </p>
  
  <p>For testing purpose I have a hardcoded secret.
  And a route to get the key</p>
  
  <pre><code>const secretKey = "YOLOSWAG"
  
  var mySigningKey = []byte(secretKey)
  
  
  var GetTokenHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
      token := jwt.New(jwt.SigningMethodHS256)
      token.Claims = jwt.MapClaims{
          "admin": true,
          "name":  "John Doe",
          "exp":   time.Now().Add(time.Hour * 24).Unix(),
      }
  
      tokenString, _ := token.SignedString(mySigningKey)
  
      w.Write([]byte(tokenString))
  })
  
  var jwtMiddleware = jwtmiddleware.New(jwtmiddleware.Options{
      ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) {
          return mySigningKey, nil
      },
      SigningMethod: jwt.SigningMethodHS256,
  })
  </code></pre>
  
  <p>and later added the jwtMiddleware to my route</p>
  
  <pre><code>r.Handle("/protected", jwtMiddleware.Handler(ProtectedTestHandler)).Methods("GET")
  </code></pre>
  
  <p>So localhost:3000/protected will output an error Required authorization token not found</p>
  
  <p>this works.</p>
  
  <p>/token will output my token. This works too.</p>
  
  <p>And finally /protected with (in postman) Authorization: Bearer {token} </p>
  
  <p>Will output illegal base64 data at input byte 0
  I am really confused why this happens. </p>