Skip to content
Used to verify JWT Token issued from Google Sign-In.
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
certs.go
encode.go
error.go
go.mod
jws.go
verify.go

README.md

Google Sign-In Token Verifier

Used to verify JWT Token issued from Google Sign-In.

How to use

package main

import (
	"fmt"

	googleidtokenverifier "github.com/movsb/google-idtoken-verifier"
)

func main() {
	token := "eyJhbGciOiJSUzI1NiIsImtpZCI6ImE0MzEzZTdmZDFl..."
	clientID := "YOUR_CLIENT_ID.apps.googleusercontent.com"
	claims, err := googleidtokenverifier.Verify(token, clientID)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Iss:\t%s\nSub:\t%s\nEmail:\t%s\nName:\t%s\nDomain:\t%s\n",
		claims.Iss, claims.Sub, claims.Email, claims.Name, claims.Domain)
}

Features

All steps described in Google Sign-In are satisfied.

G Suite

If you are using G Suite, be sure that the Domain field matches your host suffix.

You can’t perform that action at this time.