Skip to content

colwill/go-auth0-scopes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auth0 Scopes

Consume Auth0 Scopes in Go A Go middleware for gin.

License MIT

Check out Examples - for an idea on how to use this with Gin

Installation

# Go package install
go get github.com/colwill/go-auth0-scopes/

Basic Usage

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
	}
}

About

Consume Auth0 Scopes in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages