Skip to content

Instantly share code, notes, and snippets.

@ckarlof

ckarlof/test.js Secret

Last active Aug 29, 2015
Embed
What would you like to do?
manual FxA Loop login
/*
1) Install user.js in your profile dir
2) Restart Firefox
3) Open the Loop app via the toolbar button (this just initializes it)
4) Open the Browser Console
5) Run the below line of code, and login/create acccount via FxA
*/
Cu.import("resource://gre/modules/FxAccountsProfileClient.jsm");
// need to configure this manually
// dev profile server
//let profileServerURL = "https://latest.dev.lcip.org/profile/v1";
// staging profile server
//let profileServerURL = "https://profile.stage.mozaws.net/v1";
// production profile server
let profileServerURL = "https://profile.accounts.firefox.com/v1";
MozLoopService.logInToFxA().then(function(tokenData) {
console.log(tokenData);
let pc = new FxAccountsProfileClient({
serverURL: profileServerURL,
token: tokenData.access_token
});
return pc.fetchProfile();
}).then(function (profileData) {
console.log(profileData);
});
// If it prints out something not terrible, it probably worked, e.g., hopefully something like:
// Object { token_type: "bearer", access_token: "bbecd1bbde3af3d005e9dbae5366290e45b22d025b12036b3a92334dc9b8957f", scope: "profile" }
// Object { email: "foo+1111@gmail.com", uid: "ae1d9c3f50474e0c950d274b146c8bed" }
/* copy the pref group below into a user.js file created in profile dir. e.g.
* Mac: /Users/<user>/Library/Application\ Support/Firefox/Profiles/<obfuscate_chars>.default/user.js
* Win: C:/Users/Username/Appdata/Roaming/Mozilla/Firefox/Profiles/<obfuscate_chars>.default/user.js
* Lnx: ~/.mozilla/firefox/<obfuscate_chars>.default/user.js
* Restart Firefox
*/
// useful
user_pref("general.warnOnAboutConfig", false);
user_pref("devtools.chrome.enabled", true);
user_pref("devtools.debugger.remote-enabled", true);
// stage Loop server
//user_pref("loop.server", "https://loop.stage.mozaws.net");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment