0

I have a RestKit request as below. How can I get the auth token from the response headers?

    RKObjectManager.shared()
        .getObjectsAtPath(urlString,
                      parameters: paramsDictionary,
             success: {(operation: RKObjectRequestOperation?, result: RKMappingResult?) -> Void in



pod 'RestKit', '~> 0.27.0'
markhorrocks
  • 1,199
  • 19
  • 82
  • 151

1 Answers1

2

You can get response header from RKObjectRequestOperation like this way.

if let operation = operation, let headers = operation.httpRequestOperation.response.allHeaderFields as? [String:Any] {
    print(headers)// Now use subscript with headers dictionary to get your token value
}
Nirav D
  • 71,513
  • 12
  • 161
  • 183