x

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

package x uses golang.org/x/oauth2 to implement a Provider for the OAuth2 flow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuth2

type OAuth2 struct {
	Config           *oauth2.Config
	UserInfoEndpoint string
	HTTPClient       *http.Client // will use http.DefaultClient if let nil
}

OAuth2 implements a Provider for the OAuth2 flow.

func (*OAuth2) AuthCodeURL

func (o *OAuth2) AuthCodeURL(state string) (string, string, error)

AuthCodeURL returns the Auth-URL to redirect the user to

func (*OAuth2) Exchange

func (o *OAuth2) Exchange(code, verifier string) (token *oauth2.Token, unmarshalUser func(interface{}) error, err error)

Exchange exchanges the code and provides a way to unmarshal the user info

func (*OAuth2) Refresh

func (o *OAuth2) Refresh(refreshToken string) (token *oauth2.Token, unmarshalUser func(interface{}) error, err error)

func (*OAuth2) SetRedirectURL

func (o *OAuth2) SetRedirectURL(url string)

SetRedirectURL sets the local callback URL.

Jump to

Keyboard shortcuts

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