oauth

package
v0.0.0-...-baf4ea5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package oauth is a wrapper around x/oauth2 to provide oauth2 authetication for various providers

Index

Constants

View Source
const (
	ProviderGoogle   = "google"
	ProviderFacebook = "facebook"
)

Variables

This section is empty.

Functions

func AddConstProvider

func AddConstProvider(funcs template.FuncMap) template.FuncMap

func Authenticate

func Authenticate(returnTo string, errorHandler func(http.ResponseWriter, *http.Request, error)) func(http.Handler) http.Handler

func IsValidProvider

func IsValidProvider(provider string) bool

func Redirect

func Redirect(provider, returnTo string, errorHandler func(http.ResponseWriter, *http.Request, error)) http.HandlerFunc

Types

type State

type State struct {
	Csrftoken string
	Provider  string
}

type User

type User struct {
	ID            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Name          string `json:"name"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Link          string `json:"link"`
	Picture       string `json:"picture"`
	Gender        string `json:"gender"`
	Locale        string `json:"locale"`
}

Jump to

Keyboard shortcuts

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