Bug 744614 - Make token server client conform with spec change; r=rnewman
authorGregory Szorc <gps@mozilla.com>
Wed, 11 Apr 2012 15:24:21 -0700
changeset 91493 54f5a1ebcf4315b23defb6bf3d6e914e971e21a5
parent 91492 b774546790d72c97debc66afc69ebd9f8a6bcfa9
child 91494 e72c21511787eed9b1523d832012a21b72bd58e2
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersrnewman
bugs744614
milestone14.0a1
Bug 744614 - Make token server client conform with spec change; r=rnewman
services/common/tests/unit/test_tokenserverclient.js
services/common/tokenserverclient.js
--- a/services/common/tests/unit/test_tokenserverclient.js
+++ b/services/common/tests/unit/test_tokenserverclient.js
@@ -20,17 +20,17 @@ add_test(function test_working_bid_excha
       do_check_true(request.hasHeader("accept"));
       do_check_eq("application/json", request.getHeader("accept"));
 
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json");
 
       let body = JSON.stringify({
         id:           "id",
-        secret:       "key",
+        key:          "key",
         api_endpoint: service,
         uid:          "uid",
       });
       response.bodyOutputStream.write(body, body.length);
     }
   });
 
   let client = new TokenServerClient();
@@ -143,17 +143,17 @@ add_test(function test_rich_media_types(
 
   let server = httpd_setup({
     "/foo": function(request, response) {
       response.setStatusLine(request.httpVersion, 200, "OK");
       response.setHeader("Content-Type", "application/json; foo=bar; bar=foo");
 
       let body = JSON.stringify({
         id:           "id",
-        secret:       "key",
+        key:          "key",
         api_endpoint: "foo",
         uid:          "uid",
       });
       response.bodyOutputStream.write(body, body.length);
     }
   });
 
   let url = TEST_SERVER_URL + "foo";
--- a/services/common/tokenserverclient.js
+++ b/services/common/tokenserverclient.js
@@ -211,28 +211,28 @@ TokenServerClient.prototype = {
     } catch (ex) {
       let error = new TokenServerClientServerError("Invalid JSON returned " +
                                                    "from server.");
       error.response = response;
       cb(error, null);
       return;
     }
 
-    for each (let k in ["id", "secret", "api_endpoint", "uid"]) {
+    for each (let k in ["id", "key", "api_endpoint", "uid"]) {
       if (!(k in result)) {
         let error = new TokenServerClientServerError("Expected key not " +
                                                      " present in result: " +
                                                      k);
         error.response = response;
         cb(error, null);
         return;
       }
     }
 
     this._log.debug("Successful token response: " + result.id);
     cb(null, {
       id:       result.id,
-      key:      result.secret,
+      key:      result.key,
       endpoint: result.api_endpoint,
       uid:      result.uid,
     });
   }
 };