Is it possible to include multiple Authorization Headers in an HTTP message? Specifically, I would like to include one of Bearer token type (passing an OAuth access token) and one of Basic type (passing a base64 encoded username:password).
GET /presence/alice HTTP/1.1
Host: server.example.com
Authorization: Bearer mF_9.B5f-4.1JqM
Authorization: Basic YXNkZnNhZGZzYWRmOlZLdDVOMVhk
I see no reason this should not be possible, just wanted to vet it with the community to be sure.
This should be possible, you just have to add a comma between field values, e.g:
This is defined in RFC7230, section 3.2.2, Field Order:
I don't know whether all web servers accept this - at the time of writing I'm in the middle of a debate with a colleague about whether it should work or not.
No, it's not possible. See the syntax definition in http://greenbytes.de/tech/webdav/rfc7235.html#header.authorization
I had a similar question. It seems to be a quite common issue (Link to question). I ended up with changing the authorization header for the bearer token to a non standard one like
This way it is just another HTTP header and the basic http authorization will pass. If you are developing your own API this should be no problem.
Some further research
Based on the RFC 2617 here are some interesting details.