oauthservice

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderGitHub   = "github"
	ProviderGoogle   = "google"
	ProviderFacebook = "facebook"
	ProviderTwitter  = "twitter"
)

Variables

This section is empty.

Functions

func GetOAuthByUserID

func GetOAuthByUserID(userID uint64, provider string) *userOAuth.Entity

GetOAuthByUserID returns a user's OAuth binding for a provider.

func GetUserOAuthBindings

func GetUserOAuthBindings(userID uint64) map[string]*userOAuth.Entity

GetUserOAuthBindings returns active OAuth bindings keyed by provider.

func InitOAuth

func InitOAuth()

InitOAuth configures available OAuth providers.

func ProcessOAuthBind

func ProcessOAuthBind(userID uint64, gothUser goth.User) error

ProcessOAuthBind binds a provider account to an existing user.

func ProcessOAuthCallback

func ProcessOAuthCallback(gothUser goth.User) (*users.EntityComplete, error)

ProcessOAuthCallback logs in an existing OAuth user or creates a new one.

func UnbindOAuth

func UnbindOAuth(userID uint64, provider string) error

UnbindOAuth removes one OAuth binding after safety checks.

Types

type OAuthUserInfo

type OAuthUserInfo struct {
	ID        string `json:"id"`
	Login     string `json:"login"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	AvatarURL string `json:"avatar_url"`
	Bio       string `json:"bio"`
	Blog      string `json:"blog"`
	Location  string `json:"location"`
	Provider  string `json:"provider"`
}

OAuthUserInfo is the normalized user data from an OAuth provider.

Jump to

Keyboard shortcuts

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