diff --git a/README.md b/README.md index 388e18a..fe73ff0 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ func main() { return c.Query("access_token") })) api.GET("/test", func(c *gin.Context) { - c.String(http.StatusOK, "ok") + ti, _ := c.Get("Token") + c.JSON(http.StatusOK, ti) }) } diff --git a/examples/server.go b/examples/server.go index 8bd65b7..dce778c 100644 --- a/examples/server.go +++ b/examples/server.go @@ -16,7 +16,7 @@ func main() { g := gin.Default() g.GET("/authorize", server.HandleAuthorizeRequest) - g.POST("/token", server.HandleTokenRequest) + g.GET("/token", server.HandleTokenRequest) api := g.Group("/api") { api.Use(server.TokenAuth(tokenAuthHandle)) @@ -47,5 +47,6 @@ func tokenAuthHandle(c *gin.Context) (token string) { } func testHandle(c *gin.Context) { - c.String(http.StatusOK, "ok") + ti, _ := c.Get("Token") + c.JSON(http.StatusOK, ti) }