title: How to send authentication token using curl in golang?
body: <p>I'm trying to use authentication model to my golang API and I'm using gin framework. I want to send authentication token using curl, then validate it and do all the crud operation after the authentication happens.</p>
  
  <p>My code is like this:</p>
  
  <pre><code>func TokenAuthMiddleware() gin.HandlerFunc {
      return func(c *gin.Context) {
          token := c.Request.FormValue("token")
  
          if token == "" {
              respondWithError(401, "API token required", c)
              return
          }
  
          if token != os.Getenv("API_TOKEN") {
              respondWithError(401, "Invalid API token", c)
              return
          }
  
          c.Next()
      }
  }
  
  func respondWithError(code int, message string,c *gin.Context) {
      resp := map[string]string{"error": message}
  
      c.JSON(code, resp)
      c.Abort()
  }
  </code></pre>
  
  <p>Main function:</p>
  
  <pre><code>func main() {
      router := gin.Default()
      router.Use(TokenAuthMiddleware())
      router.Run(":8000")
  }
  </code></pre>
  
  <p>How can I pass the authentication token using curl?</p>