Skip to content

Instantly share code, notes, and snippets.

@lloyd
Created November 3, 2011 13:50
Show Gist options
  • Save lloyd/1336528 to your computer and use it in GitHub Desktop.
Save lloyd/1336528 to your computer and use it in GitHub Desktop.
BrowserID API doc sketch

navigator.id.get(<callback>, [options])

Prompt the user for an email address that they would like to use to authenticate to the site. The email address will be passed to the supplied callback in the form of an identity assertion, which is a signed object that asserts that a specific email address is owned by a user who is willing to share it with a specific site, at a specific time. See identity assertions for more information.

  • callback - is a required callback that will be invoked with an assertion in the case of success, and with undefined on error (for example, if the user cancels or closes the dialog)
  • options - is an optional object who's properties change the behavior of the opened dialog. Allowed properties include:
    • requiredEmail - When provided contains an email that the user must use. This is useful when a site wishes to provide privileges only to a specific user.
    • silent - (boolean) - When true, an identity will be fetched without prompting the user. Such a thing is only available when the user has chosen to stay signed in to your site. An identity assertion will be returned to the provided callback, or undefined if not available.
    • allowPersistent - When provided, the user will be provided a checkbox that will allow them to stay signed in to your site. This enables persistent login without long term cookies. If this flag is enabled, a site should also check for persistent sign in using the silent flag.

Note: This function must be invoked from a click handler when silent is false.

NOTE: this function will always prompt the user, even if they have chosen to stay logged in. Use navigator.id.getCurrent() to implement persistent sign-in.

navigator.id.logout(<callback>)

Indicate to BrowserID that the user wishes to logout from the site. This function should be called when the user logs out, and will clear the user's preference to stay signed in to your site.

navigator.id.getVerifiedEmail(<callback>)

DEPRECATED - A convenience function which will invoke getCurrent() followed by promptUser().

Identity Assertions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment