google_oauth2

package
v0.0.0-...-d36ff20 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

https://developers.google.com/identity/protocols/oauth2 https://developers.google.com/identity/protocols/oauth2/web-server https://developers.google.com/identity/openid-connect/openid-connect

func NewClient

func NewClient(project string, redirect_url string) (*Client, error)

func (*Client) AuthCodeURL

func (p *Client) AuthCodeURL(state string) string

func (*Client) Exchange

func (p *Client) Exchange(ctx context.Context, code string) (*oauth2.Token, *IdToken, error)

func (*Client) Revoke

func (p *Client) Revoke(ctx context.Context, token *oauth2.Token) error

type Config

type Config struct {
	Web Web `json:"web"`
}

type IdToken

type IdToken struct {
	Subject       string  `json:"sub"`
	Picture       *string `json:"picture,omitempty"`
	Locale        *string `json:"locale,omitempty"`
	Name          *string `json:"name,omitempty"`
	FamilyName    *string `json:"family_name,omitempty"`
	GivenName     *string `json:"given_name,omitempty"`
	Email         *string `json:"email,omitempty"`
	Profile       *string `json:"profile,omitempty"`
	EmailVerified bool    `json:"email_verified"`
}

https://developers.google.com/identity/openid-connect/openid-connect#obtainuserinfo

type Web

type Web struct {
	ClientId                string   `json:"client_id"`
	ProjectId               string   `json:"project_id"`
	AuthUri                 string   `json:"auth_uri"`
	TokenUri                string   `json:"token_uri"`
	AuthProviderX509CertUrl string   `json:"auth_provider_x509_cert_url"`
	ClientSecret            string   `json:"client_secret"`
	RedirectUris            []string `json:"redirect_uris"`
	JavascriptOrigins       []string `json:"javascript_origins"`
}

Jump to

Keyboard shortcuts

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