authentication

package
v0.0.0-...-73f3dc2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GithubAuthURL   = "https://github.com/login/oauth/authorize"
	GithubTokenURL  = "https://github.com/login/oauth/access_token"
	GithubUserURL   = "https://api.github.com/user"
	GithubEmailsURL = "https://api.github.com/user/emails"
	RedirectBaseURL = "http://localhost:9000"
)
View Source
const (
	GoogleAuthURL  = "https://accounts.google.com/o/oauth2/v2/auth"
	GoogleTokenURL = "https://oauth2.googleapis.com/token"
	GoogleUserInfo = "https://www.googleapis.com/oauth2/v3/userinfo"
)

Variables

This section is empty.

Functions

func GitHubCallback

func GitHubCallback(w http.ResponseWriter, r *http.Request)

GitHubCallback handles the callback from GitHub's OAuth 2.0 server after the user has granted the necessary permissions.

func GitHubSignIn

func GitHubSignIn(w http.ResponseWriter, r *http.Request)

GitHubSignIn initiates the GitHub sign-in process by redirecting the user to GitHub's OAuth 2.0 server for authentication.

func GitHubSignUp

func GitHubSignUp(w http.ResponseWriter, r *http.Request)

GitHubSignUp initiates the GitHub sign-up process by redirecting the user to GitHub's OAuth 2.0 server for authentication.

func GoogleCallback

func GoogleCallback(w http.ResponseWriter, r *http.Request)

GoogleCallback handles the callback from the Google OAuth 2.0 server after the user has granted the necessary permissions.

func GoogleSignIn

func GoogleSignIn(w http.ResponseWriter, r *http.Request)

GoogleSignIn initiates the Google sign-in process by redirecting the user to Google's OAuth 2.0 server for authentication.

func GoogleSignInCallback

func GoogleSignInCallback(w http.ResponseWriter, r *http.Request)

GoogleSignInCallback handles the callback from the Google OAuth 2.0 server after the user has granted the necessary permissions.

func GoogleSignUp

func GoogleSignUp(w http.ResponseWriter, r *http.Request)

GoogleSignUp initiates the Google sign-up process by redirecting the user to Google's OAuth 2.0 server for authentication.

func SetSessionCookie

func SetSessionCookie(w http.ResponseWriter, userID int)

SetSessionCookie sets a session cookie for the given user ID.

Types

type GitHubUser

type GitHubUser struct {
	Login, Email string
}

type GoogleUser

type GoogleUser struct {
	Sub, Name, Email string
}

Jump to

Keyboard shortcuts

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