Skip to content

Commit

Permalink
fix(oauth2): id is int for github
Browse files Browse the repository at this point in the history
  • Loading branch information
mentos1386 committed Feb 16, 2024
1 parent 9e237a0 commit 5dfc7f0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/handlers/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"io"
"net/http"
"strconv"
"time"

"code.tjo.space/mentos1386/zdravko/internal/config"
Expand All @@ -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"`
}
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 5dfc7f0

Please sign in to comment.