Twitter recently came out with their web version of Digits. It provides a nice way to authenticate with applications with what is traditionally known as two-step authentication, but it becomes more of a primary authentication in how they’ve targetted it.

twitter digits signin flow


angular-digits provides an integration of Digits with AngularJS. It brings the asynchronous event sinto the digiest cycle context, but it also provides a handful of utility on top of what is otherwise a pretty raw interface.

Example Usage

// inject the digits module
angular.module('app', ['atticoos.digits'])

.config(function (DigitsProvider) {
  // configure the Digits provider with your consumer key before the application's run phase

.run(function (Digits) {
  // Enter the auth flow
  Digits.login().then(function (loggedInResponse) {
    // successfully authenticated
    console.log('Authorization headers', loggedInResponse.getOAuthHeaders());
  }).catch(function (loginError) {
    if (loginError.wasPopupBlocked()) {
      // popup was blocked
    } else if (error.wasWindowClosed()) {
      // window was closed
    } else {
      // a problem with authentication occured

That’s pretty much the gist. We have a nice promise based implementation, along with some response models that make it easy to ask the model questions about what type of error occurred that prevented a successful authentication, or to retrieve the authorization headers after a successful authentication.


The package is available on bower

bower install angular-digits
angular.module('app', ['atticoos.digits']);

Twitter Flight

If you missed the Twitter Flight conference, they had a good segment on announcing Digits that’s worth checking out