Pergunta

I've a REST API backend written using Slim Framework. I'd like to send an authorization header containing an access token to a route. I've tried curl:

curl -X POST http://myhost.com/api/test -H "Authorization: OAuth 1234567890a" -H "Content-type: application/json"

Server side I receive the request but headers array hasn't any Auth header:

Slim\Http\Headers Object
(
    [data:protected] => Array
        (
            [User-Agent] => curl/7.36.0
            [Host] => myhost.com
            [Accept] => */*
            [Content-type] => application/json
        )
)

Should I set something upon Apache or what (I know I should be over SSL, but I'm just testing)? Content-type header is correctly received...

EDIT: I just figured out that apache_request_headers() method contains the correct Authorization header. Why does Slim fails to show it?

Foi útil?

Solução

Server side, I currently use getallheaders() function to catch the auth content.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top