Skip to content

Commit

Permalink
Updates refreshTokenHalder to use the corectly the context instead of…
Browse files Browse the repository at this point in the history
… headers
  • Loading branch information
emmdim committed Aug 29, 2024
1 parent f1391b2 commit b246e71
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
// refresh handles the refresh request. It returns a new JWT token.
func (a *API) refreshTokenHandler(w http.ResponseWriter, r *http.Request) {
// retrieve the user identifier from the HTTP header
userID := r.Header.Get("X-User-Id")
if userID == "" {
user, ok := userFromContext(r.Context())
if !ok {
ErrUnauthorized.Write(w)
return
}
// generate a new token with the user name as the subject
res, err := a.buildLoginResponse(userID)
res, err := a.buildLoginResponse(user.Email)
if err != nil {
ErrGenericInternalServerError.Write(w)
return
Expand Down

0 comments on commit b246e71

Please sign in to comment.