Skip to content

movsb/google-idtoken-verifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages