Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Nos bénévoles n'ont pas encore traduit cet article en Français. Aidez-nous à réaliser cette tâche !

Not native
This feature is not built into all browsers. To use it reliably, you'll need to include a JavaScript library in your page as a polyfill. You can include the library from https://login.persona.org/include.js.

Summary

This function enables a web site to use BrowserID to authenticate its users. Call it in the click handler to your "log in with Persona" button with a callback function as a parameter.

navigator.id.get() will ask the user to choose an email address to sign in with, and may ask the user for their Persona password if the user's certificate has expired. It will then generate a signed assertion containing the user's email address, passing the assertion into the callback.

If for any reason the signed assertion cannot be generated (for example, if the user canceled login, or the user supplied the wrong password) then the callback will be called with NULL.

When the callback receives the signed assertion, it should send it to the server for verification.

Syntax

navigator.id.get(gotAssertion);
navigator.id.get(gotAssertion, {privacyPolicy: "/privacy.html", termsOfService: "/tos.html"});

Parameters

gotAssertion
A function which will be called with a signed assertion object or NULL. The callback should send the assertion to the server for verification.
backgroundColor Optional
A hexadecimal color to use as the login dialog's background. Format: "#rgb" or "#rrggbb".
privacyPolicy Optional
Must be served over SSL. The termsOfService parameter must also be provided.
Absolute URL to the web site's privacy policy. If provided, then termsOfService must also be provided. When both termsOfService and privacyPolicy are given, the login dialog informs the user that, by continuing, "you confirm that you accept this site's Terms of Use and Privacy Policy." The dialog provides links to the the respective policies.
termsOfService Optional
Must be served over SSL. The privacyPolicy parameter must also be provided.
Absolute URL to the web site's terms of service. If provided, then privacyPolicy must also be provided. When both termsOfService and privacyPolicy are given, the login dialog informs the user that, by continuing, "you confirm that you accept this site's Terms of Use and Privacy Policy." The dialog provides links to the the respective policies.
siteLogo Optional
Must be served over SSL.
Absolute path to an image to show in the login dialog. The path must begin with '/'. Larger images will be scaled down to fit within 100x100 pixels.
siteName Optional
Plain text name of your site to show in the login dialog. Unicode and whitespace are allowed, but markup is not.

Example

Example needed.

Specification

Not included in any specification.

See also

Étiquettes et contributeurs liés au document

 Contributeurs à cette page : teoli, MHasan, timpas53, wbamberg, kscarfone, ozten, Callahad, Sheppy, ethertank, lloydhilaiel
 Dernière mise à jour par : teoli,