JavaScript API

The JavaScript file that comes with django-browserid, browserid.js, includes a a few public functions that are exposed through the django_browserid global object.

django_browserid.login([next, requestArgs])

Manually trigger BrowserID login.

Arguments:
  • next (string) – URL to redirect the user to after login.
  • requestArgs (object) – Options to pass to navigator.id.request.
django_browserid.logout([next])

Manually trigger BrowserID logout.

Arguments:
  • next (string) – URL to redirect the user to after logout.
django_browserid.isUserAuthenticated()

Check if the current user has authenticated via django_browserid. Note that this relies on the #browserid-info element having been loaded into the DOM already. If it hasn’t, this will return false.

Returns:True if the user has authenticated, false otherwise.
django_browserid.getAssertion(callback)

Retrieve an assertion from BrowserID and execute the given callback with the assertion as the single argument.

Arguments:
  • callback (function) – Callback to execute after the assertion has been retrieved.
django_browserid.verifyAssertion(assertion[, redirectTo])

Verify an assertion, and redirect to a URL on success. Calling this method submits a form to the server and changes the current page as if the user was attempting to login.

Arguments:
  • assertion (string) – Assertion to verify.
  • redirectTo (string) – URL to redirect to on success.

Project Versions

Previous topic

API

Next topic

Developer Setup

This Page