diff --git a/api/account/account.go b/api/account/account.go index 8f2b7b5..77c19ea 100644 --- a/api/account/account.go +++ b/api/account/account.go @@ -108,8 +108,9 @@ func (a AccountAPI) login(jc jape.Context) { return } - jc.ResponseWriter.Header().Set("Authorization", "Bearer "+jwt) - jc.ResponseWriter.WriteHeader(http.StatusOK) + jc.Encode(&LoginResponse{ + Token: jwt, + }) } func (a AccountAPI) register(jc jape.Context) { diff --git a/api/account/messages.go b/api/account/messages.go index a03b9d2..6dc7eba 100644 --- a/api/account/messages.go +++ b/api/account/messages.go @@ -5,6 +5,10 @@ type LoginRequest struct { Password string `json:"password"` } +type LoginResponse struct { + Token string `json:"token"` +} + type RegisterRequest struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` diff --git a/api/account/swagger.yaml b/api/account/swagger.yaml index a36e491..2e57678 100644 --- a/api/account/swagger.yaml +++ b/api/account/swagger.yaml @@ -16,11 +16,10 @@ paths: responses: '200': description: Successfully logged in - headers: - Authorization: + content: + application/json: schema: - type: string - description: Bearer token for the session + $ref: '#/components/schemas/LoginResponse' '401': description: Unauthorized /api/auth/register: @@ -132,6 +131,11 @@ components: type: string password: type: string + LoginResponse: + type: object + properties: + token: + type: string RegisterRequest: type: object required: