1

I'm developing an iOS application and using Deployd as backend .The problem is when I send a GET request to users/me with a sid cookie to identify my session, It returns 204-no content, even though user is logged-in. I'm expecting some data in return.

Xcode console output:

<NSHTTPURLResponse: 0x136ed2e00> { URL: http://xxxxxxxxxxxxxxx:2403/users/me?sid=3f53dd6c10...9fc4a00 } { status code: 204, headers {
"Cache-Control" = "no-cache, no-store, must-revalidate";
Connection = "keep-alive";
Date = "Sat, 16 Jan 2016 18:55:16 GMT";
Expires = 0;
Pragma = "no-cache"; } }
Edwards
  • 131
  • 14

1 Answers1

1

So I was sending SID as parameter, It was incorrect. Deployd demands a 'barrier token'.

Swift code:

let url = NSURL(string: "http:/xxxxxxxxxxxxxxxx.com:2403/users/me")
            let request = NSMutableURLRequest(URL: url!)
            request.HTTPMethod = "GET"
            request.setValue( "Bearer \(token!)", forHTTPHeaderField: "Authorization")

            NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.currentQueue()!) { response, maybeData, error in
                if let data = maybeData {
                    let contents = NSString(data:data, encoding:NSUTF8StringEncoding)
                    print(contents!, "bitch")
                } else {
                    print(error!.localizedDescription)
                }
            }
Edwards
  • 131
  • 14
  • Man you are the biggest ****ing legend. Where did you even find that thing about the barrier token? I had such a big problem with getting the auth working, like it took days and days. I could not find anything about this way of doing it anywhere. You have saved my life. – Varrick Sep 02 '16 at 15:09