Help us shape the future of Go! Take the 2026 Go Developer Survey

google

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package google is the Google OpenID Connect wire adapter: authorization URLs and the authorization-code exchange. It holds no storage or diffx policy.

Index

Constants

This section is empty.

Variables

View Source
var ErrRejected = errors.New("google sign-in rejected")

ErrRejected reports an exchange or ID token Google or this client refused.

Functions

func Challenge

func Challenge(verifier string) string

Challenge derives the S256 PKCE challenge for a verifier.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(clientID, clientSecret, redirectURI string, options ...Option) *Client

func (*Client) AuthorizeURL

func (c *Client) AuthorizeURL(state, nonce, verifier string) string

func (*Client) Exchange

func (c *Client) Exchange(ctx context.Context, code, verifier, nonce string) (Identity, error)

Exchange redeems the code and validates the returned ID token's claims. The token comes directly from Google's token endpoint over TLS, so its signature is not checked (OpenID Connect Core 3.1.3.7).

type Identity

type Identity struct {
	Subject       string
	Email         string
	EmailVerified bool
}

Identity is the verified subject of an ID token. Subject is stable for the Google account; Email can change.

type Option

type Option func(*Client)

func WithEndpoints

func WithEndpoints(authorize, token string) Option

WithEndpoints replaces Google's endpoints in tests.

Jump to

Keyboard shortcuts

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