GoogleIdTokenVerifier

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2021 License: MIT Imports: 16 Imported by: 0

README

GoogleIdTokenVerifier

To validate an Google ID Token in Golang

Usage:

authToken := "XXXXXXXXXXX.XXXXXXXXXXXX.XXXXXXXXXX"

aud := "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com"

fmt.Println(Verify(authToken, aud))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCertsFromURL

func GetCertsFromURL() []byte

Types

type Certs

type Certs struct {
	Keys []keys `json:"keys"`
}

func GetCerts

func GetCerts(bt []byte) *Certs

type TokenInfo

type TokenInfo struct {
	Sub           string `json:"sub"`
	Email         string `json:"email"`
	AtHash        string `json:"at_hash"`
	Aud           string `json:"aud"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Picture       string `json:"picture"`
	Local         string `json:"locale"`
	Iss           string `json:"iss"`
	Azp           string `json:"azp"`
	Iat           int64  `json:"iat"`
	Exp           int64  `json:"exp"`
}

func Verify

func Verify(authToken string, aud string) *TokenInfo

func VerifyGoogleIDToken

func VerifyGoogleIDToken(authToken string, certs *Certs, aud string) *TokenInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL