Hubo errores de script en esta página. Mientras los editores del sitio lo solucionan, puedes ver un contenido parcial debajo.
gotAssertionis the callback argument to
navigator.id.get() API takes a set of options as an optional parameter. By using two of these options,
silent, you can enable the user to stay logged into your web site until the certificate signed by their identity provider expires.
allowPersistent like this:
This option causes a new checkbox to appear in the BrowserID dialog asking the user if they want to stay signed in. If the user checks the box to stay signed in, then the browser creates an assertion and passes it to
gotAssertion as normal, but remembers the user selection.
silent like this:
With this option the browser will not display any dialog to the user, but will call
gotAssertion without any user intervention. If the user had checked the box to stay signed in, and the user's certificate has not yet expired, then the browser will silently generate a new assertion and pass it into
gotAssertion. Otherwise, the browser will pass
Supporting Persistent Login
First, on page load, call
gotAssertion, if the assertion is not
null and validates, log the user in, otherwise call
loggedOut() updates the page to indicate that the user is logged out. In particular, the page needs to display a "Sign In" button whose click handler will call
Requiring a Specific Email
BrowserID enables a user to have multiple identities, and choose which one to sign in with. If a user has multiple email addresses which can be verified using BrowserID, then when a web site calls
navigator.id.get(), the user will be presented with all their addresses, and asked which one to use.
Sometimes, though, a web site knows which email the user needs to choose. For example, if Alice shares a photo with Bob using a BrowserID-enabled photo-sharing site, the web site needs to authenticate Bob against the exact email address Alice used to invite him. If Bob chooses the wrong email from multiple choices the invitation will fail.
In this situation the web site can require that the user use a particular email address by setting the
requiredEmail option as an argument to
navigator.id.get(). For example:
Even if Bob has multiple email addresses, he'll only be presented with "firstname.lastname@example.org". The web site's
gotAssertion() function is guaranteed to be called with either an assertion for "email@example.com", or with a null assertion.