Documentation
¶
Index ¶
- Constants
- func GitHubCallback(w http.ResponseWriter, r *http.Request)
- func GitHubSignIn(w http.ResponseWriter, r *http.Request)
- func GitHubSignUp(w http.ResponseWriter, r *http.Request)
- func GoogleCallback(w http.ResponseWriter, r *http.Request)
- func GoogleSignIn(w http.ResponseWriter, r *http.Request)
- func GoogleSignInCallback(w http.ResponseWriter, r *http.Request)
- func GoogleSignUp(w http.ResponseWriter, r *http.Request)
- func SetSessionCookie(w http.ResponseWriter, userID int)
- type GitHubUser
- type GoogleUser
Constants ¶
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" )
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
}