readd in password auth
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user