diff --git a/http/swagger.yml b/http/swagger.yml index 4c61dd27de..650f97cb0f 100644 --- a/http/swagger.yml +++ b/http/swagger.yml @@ -6088,6 +6088,8 @@ components: id: readOnly: true type: string + oauthID: + type: string name: type: string status: diff --git a/http/user_service.go b/http/user_service.go index 6638429fa1..cbe41b6762 100644 --- a/http/user_service.go +++ b/http/user_service.go @@ -180,21 +180,15 @@ func (h *UserHandler) handleGetMe(w http.ResponseWriter, r *http.Request) { return } - var id influxdb.ID - switch s := a.(type) { - case *influxdb.Session: - id = s.UserID - case *influxdb.Authorization: - id = s.UserID - } + id := a.GetUserID() + user, err := h.UserService.FindUserByID(ctx, id) - b, err := h.UserService.FindUserByID(ctx, id) if err != nil { EncodeError(ctx, err, w) return } - if err := encodeResponse(ctx, w, http.StatusOK, newUserResponse(b)); err != nil { + if err := encodeResponse(ctx, w, http.StatusOK, newUserResponse(user)); err != nil { EncodeError(ctx, err, w) return } diff --git a/user.go b/user.go index 2461c18e8d..52c99d55e9 100644 --- a/user.go +++ b/user.go @@ -6,8 +6,9 @@ import ( // User is a user. 🎉 type User struct { - ID ID `json:"id,omitempty"` - Name string `json:"name"` + ID ID `json:"id,omitempty"` + Name string `json:"name"` + OAuthID string `json:"oauthID,omitempty"` } // Ops for user errors and op log.