WebAPI/MobileIdentity: Difference between revisions
(Created page with "= Mobile Identity API = The Mobile Identity WebAPI enables web application authors to obtain a verified phone number ([http://en.wikipedia.org/wiki/MSISDN MSISDN]) after the u...") |
|||
| Line 22: | Line 22: | ||
[[File:MobileIdFxosDialog.gif|480px|thumb|center|Mobile Identity Firefox OS dialog]] | [[File:MobileIdFxosDialog.gif|480px|thumb|center|Mobile Identity Firefox OS dialog]] | ||
=== Code example === | === Code example === | ||
<code> | |||
function verifyAssertion(aAssertion) { | |||
// Make use of the [https://wiki.mozilla.org/Identity/Firefox_Accounts#Verifier remote verification API] | |||
// and return the verified msisdn. | |||
} | |||
// Request a mobile identity assertion and force the chrome UI to | |||
// allow the user to change a possible previous selection. | |||
navigator.getMobileIdAssertion({ forceSelection: true }) | |||
.then( | |||
(assertion) => { | |||
var msisdn = verifyAssertion(assertion); | |||
// Do stuff with the msisdn. | |||
}, | |||
(error) { | |||
// Process error. | |||
}; | |||
); | |||
</code> | |||
= Implementation details = | = Implementation details = | ||
Revision as of 16:35, 11 July 2014
Mobile Identity API
The Mobile Identity WebAPI enables web application authors to obtain a verified phone number (MSISDN) after the user selected the number to be shared and gave explicit permission to the app to obtain it.
DOM API
dictionary MobileIdOptions {
boolean forceSelection = false;
};
partial interface Navigator {
Promise getMobileIdAssertion(optional MobileIdOptions options);
};
The returned Promise will be resolved with a verifiable BrowserId assertion containing the user's phone number as the verifiedMSISDN field or it will be rejected with a DOMError object containing one of the following error strings:
- OFFLINE
- DIALOG_CLOSED_BY_USER
Permission model
The API is exposed to Firefox OS privileged and certified applications that should list the mobileid permission in their manifests. The user needs to provide explicit permission to the origin requesting the phone number. This permission is given through the user agent chrome UI and it is remembered per origin by default.
Code example
function verifyAssertion(aAssertion) {
// Make use of the remote verification API
// and return the verified msisdn.
}
// Request a mobile identity assertion and force the chrome UI to
// allow the user to change a possible previous selection.
navigator.getMobileIdAssertion({ forceSelection: true })
.then(
(assertion) => {
var msisdn = verifyAssertion(assertion);
// Do stuff with the msisdn.
},
(error) {
// Process error.
};
);
Implementation details
Current status
Implemented and enabled in Firefox OS 2.0 and allowed for certified and privileged apps.
