title: Braintree node.js w/ iOS 9 Swift 2.1 - client token error
body: <p>I'm attempting to setup a relatively simple Braintree server running on node.js with my client written in Swift 2.1 for iOS 9, and while I'm able to log the client token, I'm getting the following error:</p>
  
  <p><code>[BraintreeSDK] ERROR Unsupported client token version. Please ensure your server is generating a valid Braintree ClientToken with a server-side SDK that is compatible with this version of Braintree iOS.</code></p>
  
  <p>Below is my server code (which was adapted from a BraintreeDev repository):</p>
  
  <pre><code>'use strict';
  
  var express = require('express');
  var app = express();
  
  var braintree = require('braintree');
  
  var bodyParser = require('body-parser');
  var parseUrlEnconded = bodyParser.urlencoded({
    extended: false
  });
  
  var gateway = braintree.connect({
    environment: braintree.Environment.Sandbox,
    merchantId: 'xxxxxxxxxxxxx',
    publicKey: 'xxxxxxxxxxxxxxx',
    privateKey: 'xxxxxxxxxxxxxxxxxxxxxxx'
  });
  
  app.use(express.static('public'));
  
  app.set('views', __dirname + '/views');
  app.set('view engine', 'ejs');
  
  // Creates a new token and returns it in the response.
  app.get('/token', function (req, res) {
    gateway.clientToken.generate({}, function (error, response) {
      res.json(response);
    });
  });
  
  app.post('/payment', function (req, res) {
    var sale = {
      amount: "10",
      payment_method_nonce: req.param('payment_method_nonce')
    };
  
    gateway.transaction.sale(sale, function (error, response) {
      if (!error &amp;&amp; response.success) {
        res.json(response);
      } else {
        // do something else
      }
    });
  });
  
  
  app.listen(process.env.PORT || 5000)
  
  module.exports = app;
  </code></pre>
  
  <p>And here is my iOS code:</p>
  
  <pre><code>class BaseViewController: UIViewController {
  
      var braintreeClient: BTAPIClient?
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          let clientTokenURL = NSURL(string: "https://my-heroku-app.herokuapp.com/token")!
          let clientTokenRequest = NSMutableURLRequest(URL: clientTokenURL)
          clientTokenRequest.setValue("text/plain", forHTTPHeaderField: "Accept")
  
          NSURLSession.sharedSession().dataTaskWithRequest(clientTokenRequest) { (data, response, error) -&gt; Void in
              guard let data = data else {
                  return
              }
  
              let clientToken = String(data: data, encoding: NSUTF8StringEncoding)
              print("Client Token: \(clientToken)")
              self.braintreeClient = BTAPIClient(authorization: clientToken!)
              print(response?.description)
  
          }.resume()
      }
  ...
  </code></pre>
  
  <p>This seems like something that should be very straight forward, and I'm having trouble understanding why I'm getting this error.</p>
  
  <p>EDIT:  I am using the most recent version of the Braintree SDK for iOS and the most recent version of the Braintree node.js package.</p>