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
--- 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"));