From 5dfc7f022722dbc51b01686eb39af403f8112022 Mon Sep 17 00:00:00 2001 From: Tine Date: Fri, 16 Feb 2024 15:07:52 +0100 Subject: [PATCH] fix(oauth2): id is int for github --- internal/handlers/oauth2.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/handlers/oauth2.go b/internal/handlers/oauth2.go index c3837b6..06ad738 100644 --- a/internal/handlers/oauth2.go +++ b/internal/handlers/oauth2.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "net/http" + "strconv" "time" "code.tjo.space/mentos1386/zdravko/internal/config" @@ -16,7 +17,7 @@ import ( ) type UserInfo struct { - Id int64 `json:"id"` // FIXME: This might not always be int? + Id int `json:"id"` // FIXME: This might not always be int? Sub string `json:"sub"` Email string `json:"email"` } @@ -138,9 +139,9 @@ func (h *BaseHandler) OAuth2CallbackGET(w http.ResponseWriter, r *http.Request) return } - userId := userInfo.Id - if userInfo.Sub != "" { - userId = userInfo.Sub + userId := userInfo.Sub + if userInfo.Id != 0 { + userId = strconv.Itoa(userInfo.Id) } err = h.SetAuthenticatedUserForRequest(w, r, &AuthenticatedUser{