Bug 1313731 - Append /v1 to fxaccount's autoconfig's auth_server_base_url if not present r?markh draft
authorThom Chiovoloni <tchiovoloni@mozilla.com>
Wed, 02 Nov 2016 12:15:26 -0400
changeset 432724 d223fa8f9f410e1ff82ea22fc2c427eb4e2c48e2
parent 432719 374fb57de7e291c0e5bc4efa99c2d6ed72fa844d
child 535732 6b7014c5948ab9e359e6472855f6b639580071cf
push id34400
push userbmo:tchiovoloni@mozilla.com
push dateWed, 02 Nov 2016 16:22:11 +0000
reviewersmarkh
bugs1313731
milestone52.0a1
Bug 1313731 - Append /v1 to fxaccount's autoconfig's auth_server_base_url if not present r?markh Currently the fxaccounts content server passes this through directly from its configuration files, and accepts this as either containing the trailing /v1 or not. On stage, it contains it, but on dev it does not. In the near future, it should be possible to append the trailing /v1 unconditionally, as the FxA content server is being changed to never send it down (which will be consistent with the other prefs), however it's done conditionally as to not break autoconfig against stage in the mean time. MozReview-Commit-ID: AStTm2hHVHQ
services/fxaccounts/FxAccountsConfig.jsm
--- a/services/fxaccounts/FxAccountsConfig.jsm
+++ b/services/fxaccounts/FxAccountsConfig.jsm
@@ -139,17 +139,21 @@ this.FxAccountsConfig = {
         resolve(request.response.body);
       });
     });
 
     log.debug("Got successful configuration response", jsonStr);
     try {
       // Update the prefs directly specified by the config.
       let config = JSON.parse(jsonStr)
-      Services.prefs.setCharPref("identity.fxaccounts.auth.uri", config.auth_server_base_url);
+      let authServerBase = config.auth_server_base_url;
+      if (!authServerBase.endsWith("/v1")) {
+        authServerBase += "/v1";
+      }
+      Services.prefs.setCharPref("identity.fxaccounts.auth.uri", authServerBase);
       Services.prefs.setCharPref("identity.fxaccounts.remote.oauth.uri", config.oauth_server_base_url + "/v1");
       Services.prefs.setCharPref("identity.fxaccounts.remote.profile.uri", config.profile_server_base_url + "/v1");
       Services.prefs.setCharPref("identity.sync.tokenserver.uri", config.sync_tokenserver_base_url + "/1.0/sync/1.5");
       // Update the prefs that are based off of the autoconfig url
 
       let contextParam = encodeURIComponent(
         Services.prefs.getCharPref("identity.fxaccounts.contextParam"));