readd in password auth

This commit is contained in:
2026-08-06 14:54:20 -04:00
parent 16a38c972c
commit af2d823705
5 changed files with 53 additions and 6 deletions
+17
View File
@@ -1,11 +1,26 @@
package main
import (
"context"
"net/http"
"astraltech.xyz/calendar/v2/auth"
"astraltech.xyz/calendar/v2/caldav"
"astraltech.xyz/calendar/v2/webserver"
)
func handleUser(w http.ResponseWriter, r *http.Request) {
// Load the stored token
token, err := auth.TestTokenStore.Load()
if err != nil {
http.Error(w, "Not authenticated", http.StatusUnauthorized)
return
}
// Create an HTTP client that attaches the access token
client := auth.OAuthConfigs[0].Client(context.Background(), token)
}
func main() {
auth.CreateTestOAuth()
read_config()
@@ -16,6 +31,8 @@ func main() {
AuthRequestFunction: auth.HandleAuthRequest,
})
webserver.ServeWebpage("/callback", auth.OAuthCallback)
webserver.ServeWebpage("/user", handleUser)
webserver.EnableLogoRoute()
webserver.EnableStaticRoute()
webserver.ServeWebserver()