I tried to add custom header with this:
let manager = Manager.sharedInstance
manager.session.configuration.HTTPAdditionalHeaders = [
"Authorization": "Token \(token)"
]
But it doesn't work, what am i doing wrong?
I need to add this after login, so that header will be used in all requests.
A way to do this is to use a RequestAdapter as demoed on the Alamofire advanced usage documentation.
I don't know where you do that but my AlomoFire requests look like :
Alamofire.request(.GET, urlPath, parameters: parameters, headers: ["X-API-KEY": apiKey, "Content-type application":"json", "Accept application" : "json"]).responseJSON() { (req,res, data, error) in //blah blah }
My guess is that you can put your header information into that headers array
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With