Skip to content

A module to easily validate aws cognito jwt token

Notifications You must be signed in to change notification settings

AyWa/jwt-cognito

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jwt-cognito codecov

jwt-cognito is a helper package that will allow you to validate quickly and seamlessly jwt token created by AWS cognito

Installation

go get github.com/AyWa/jwt-cognito

Usage and examples

For more usage see the godoc ~

Simple init and token check

import (
  "fmt"

  cognito "github.com/AyWa/jwt-cognito"
)

// Initialize the cognito helper: aws cognito region, aws cognito userPool id
auth := cognito.New("us-east-1", "us-east-1_XXXXXXX")

// validate a token
// It will return error if the token is not valid
payload, err := auth.ValidateToken("xx.yy.zz")
if err != nil {
  panic(err)
}

// you can use the payload to get the user info etc
fmt.Println(payload[email])

About

A module to easily validate aws cognito jwt token

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages