Tom11
Tom11

Reputation: 2519

REST server response to authorization

I have a question about REST. I´m creating a service, in which the client sends HTTP request with Basic authorization (Header Authorization: Basic user:password). I want the server to control user credentials, and if they are correct, it would send 200 OK, otherwise 401 Unauthorized. If the credentials are OK, I want to send back also user´s ID. My question is, what would be the best way to send that? My options are: headers, or json in the body of the response. Thanks you in advance.

Upvotes: 1

Views: 107

Answers (1)

SteveP
SteveP

Reputation: 19093

Personally, I would send it back in the body. I don't think there are any standard headers suitable for that type of information, unless you are setting it in a cookie.

Upvotes: 2

Related Questions