Patches to provide native sign in to the browser.
You can download try builds of these for MacOSX, Linux, and Windows here:
http://people.mozilla.org/~jparsons/firefox/picl-builds/
Those builds are packaged like Firefox nightlies, so you just need to download and install them. No compiling necessary.
If you want to compile and play, the patches apply to mozilla-central in this order:
> hg qapplied
sign-in-to-website
sign-in-to-browser
Then ./mach build
at the root of your mozilla-central
repo.
Latest tbpl: Thu Apr 11 21:43:53 2013 PDT
Visit the chrome url chrome://browser/content/browser-id-signIn.html
- In
about:config
, setdevtools.chrome.enabled
totrue
- Open Tools → Web Developer → Scratchpad
- Choose Environment → Browser
- Use code like that below:
let Cu = Components.utils;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/identity/MinimalIdentity.jsm');
function createAccount(email, password, origin) {
// Create an account, sign in, and return the assertion
IdentityService.createAccount({
email: email,
password: password,
origin: origin,
allowUnverified: true},
function(assertion) {
alert("create account success: " + assertion);
}
);
}
function signIn(email, password, origin) {
// Sign in and return an assertion
IdentityService.signIn({
email: email,
password: password,
origin: origin,
allowUnverified: true},
function (assertion) {
alert("signed in: " + assertion);
}
);
}
function signOut() {
// Sign the current user out
IdentityService.signOut(
function(result) {
alert("signed out: " + result);
}
);
}
function getIdentity(origin) {
// If the user is signed in, return an assertion for the origin.
// Otherwise, return null.
IdentityService.getIdentity({
origin: origin},
function (assertion) {
alert("got identity: " + assertion);
}
);
}
function accountExists(email) {
// Test whether the current account exists
IdentityService.accountExists({
email: email},
function (info) {
alert("account exists? " + info.state);
}
);
}
// Probably want to make up your own usernames and passwords
var EMAIL = 'gnorts@mr.ali.en';
var PASSWORD = 'i like pie!';
var ORIGIN = 'https://firefox.com';
//createAccount(EMAIL, PASSWORD, ORIGIN);
//signIn(EMAIL, PASSWORD, ORIGIN);
//signOut();
//accountExists(EMAIL);
getIdentity(ORIGIN);