NSURLSession serialization error with post request
<p>I am trying to get access token for Instagram but getting frequent error <code>You must provide client id</code>. <strong>I think it is a serialization problem as my parameters are not being serialized properly.</strong>
I tried it on <code>POSTMAN</code> and it is working well but on <code>NSURLSession</code> it throws error.</p>

<p><strong>ERROR</strong></p>

<pre><code>{
    code = 400;
    "error_message" = "You must provide a client_id";
    "error_type" = OAuthException;
}
</code></pre>

<p>What am I doing wrong here while serializing it.</p>

<pre><code>let instaInfoDict = NSDictionary(objects: ["client_id","client_secret","grant_type","redirect_uri","code"], forKeys: [kCLientIdInstagram,kCLientSecretIdInstagram,"authorization_code",kRedirectUriInstagram,code])
// Hit post request with params
WebServices().postRequest(kAccessTokenGenerationInstagram, bodyData: instaInfoDict, completionBlock: { (responseData) in
                print(responseData)

})


//WEBSERVICE CLASS:

 func postRequest(url:String, bodyData:NSDictionary, completionBlock:WSCompletionBlock){
        if let url = NSURL(string: url){
            let headers = [
                "Accept": "application/json",
                "content-type": "application/json"]

            let session = NSURLSession.sharedSession()

            let request = NSMutableURLRequest(URL: url, cachePolicy: .UseProtocolCachePolicy, timeoutInterval: 10)
            request.HTTPMethod = "POST"
            request.allHTTPHeaderFields = headers

            request.HTTPBody = try! NSJSONSerialization.dataWithJSONObject(bodyData, options: [.PrettyPrinted])

            let task =  session.dataTaskWithRequest(request, completionHandler: { (data, response, error) in
       if error != nil {
            // Handle error


            completionBlock!(responseData:nil)
        }
        else{
//Parsing the data
            let parsedData = parseJson(response as? NSData)

            completionBlock!(responseData: parsedData)

        }

            })

            task.resume()
        }


    }
</code></pre>

<p><strong>I have tried this as well</strong></p>

<pre><code>request.HTTPBody = try! NSJSONSerialization.dataWithJSONObject(bodyData, options: NSJSONWritingOptions(rawValue: 0))
</code></pre>