Search code examples
curlheadertokenafnetworking-2nsurlsession

how to set the authorization token based on this curl?


I want add a token for Authorisation to the header. Here it is the curl that my backend ask me to set before any interaction:

curl -H 'Authorization: Token token="replace-with-token"' http://domain.com/topic

here is my code:

 [config setHTTPAdditionalHeaders:@{@"Authorization":@"token=\"4959a0bc00a15e335fb6\""}];

I keep getting "HTTP Token: Access denied." does any one know reason?


Solution

  • I believe it would be this?:

    [config setHTTPAdditionalHeaders:@{@"Authorization":@"Token token=\"4959a0bc00a15e335fb6\""}];