GoogleIdTokenVerifier

package module
v0.0.0-...-0ac14b6 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2017 License: MIT Imports: 14 Imported by: 0

README

GoogleIdTokenVerifier

To validate an Google ID Token in Golang

Usage:

authToken := "XXXXXXXXXXX.XXXXXXXXXXXX.XXXXXXXXXX"

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

tokenInfo, err := Verify(authToken, aud)

if err != nil {
    // handle error
}

fmt.Println(tokenInfo)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCertsFromURL

func GetCertsFromURL() ([]byte, error)

GetCertsFromURL is

Types

type Certs

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

Certs is

func GetCerts

func GetCerts(bt []byte) *Certs

GetCerts is

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"`
}

TokenInfo is

func Verify

func Verify(authToken string, aud string) (*TokenInfo, error)

Verify is

func VerifyGoogleIDToken

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

VerifyGoogleIDToken is

Jump to

Keyboard shortcuts

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