title: Auth0 in Go Martini
body: <p>I'm trying to use Auth0 with Martini in Go. I'm using their <a href="https://auth0.com/docs/server-apis/golang" rel="nofollow">examples</a> but I can't seem to get it working no matter what I try.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>package main
  
  import (
    "flag"
    "github.com/go-martini/martini"
    "github.com/martini-contrib/render"
    "github.com/auth0/go-jwt-middleware"
    "encoding/base64"
    "github.com/dgrijalva/jwt-go"
    "net/http"
  )
  
  func main() {
    m := martini.Classic()
    port := flag.String("port", "8000", "HTTP Port")
    flag.Parse()
  
    jwtMiddleware := jwtmiddleware.New(jwtmiddleware.Options{
      ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) {
        decoded, err := base64.URLEncoding.DecodeString("&lt;token&gt;")
        if err != nil {
          return nil, err
        }
        return decoded, nil
      },
    })
  
    m.Use(render.Renderer(render.Options{
      IndentJSON: true, // Output human readable JSON
    }))
  
    m.Get("/", jwtMiddleware.Handler, func(res http.ResponseWriter, req *http.Request) { // res and req are injected by Martini
      res.WriteHeader(200) // HTTP 200
    })
  
    // Get the PORT from the environment.
    m.RunOnAddr(":" + *port)
  
  }
  </code></pre>
  
  <p>When I run that, I get a panic that says <code>Value not found for type http.Handler</code></p>
  
  <p>If I change the <code>jwtMiddleware.Handler</code> to <code>jwtMiddleware.HandlerWithNext</code>, I get a panic for <code>Value not found for type http.HandlerFunc</code>.</p>
  
  <p>Does anyone have any ideas what I'm doing wrong?</p>