/cognito-go

JWT Authentication with AWS Cognito in Go + Gin Middleware

Primary LanguageGoApache License 2.0Apache-2.0

cognito-go build Go Report Card Coverage Status

JWT Authentication with AWS Cognito in Go + Gin Middleware

Usage

Single

import "github.com/hiepd/cognito-go"

c, _ := cognito.NewCognito("ap-southeast-2", "cognito-app", "xxx")
token, err := c.VerifyToken("abc")

Gin Middleware

import (
  "github.com/hiepd/cognito-go"
  "github.com/gin-gonic/gin"
)

c, _ := cognito.NewCognito("ap-southeast-2", "cognito-app", "xxx")
r := gin.New()
r.GET("/protected", c.Authorize(), protectedEndpoint)