Consume Auth0 Scopes in Go A Go middleware for gin.
Check out Examples - for an idea on how to use this with Gin
# Go package install
go get github.com/colwill/go-auth0-scopes/import (
middleware "github.com/colwill/go-auth0-scopes"
)
var router = gin.Default()
func main() {
router.Use(middleware.ScopeUnwrap())
router.GET("/protected", middleware.Authorise("read:protected"), func(c *gin.Context) {
c.IndentedJSON(http.StatusOK, gin.H{"message": "this is a protected route!"})
})
err = router.Run()
if err != nil {
return
}
}