Skip to content

Cannonball for Web featuring an end-to-end Digits Web Demo in JavaScript and Node.

License

Notifications You must be signed in to change notification settings

rayrc/cannonball-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cannonball for Web

This repository contains the source code for the simple website presenting Cannonball and featuring an end-to-end Digits Web Demo built in JavaScript and Node.

Screenshot of Cannonball for Web

About Cannonball

Cannonball is a canonical sample iOS and Android app to demonstrate how to use Fabric, the easiest way to build the best apps.

Cannonball uses many of the features available in Fabric, including Crashlytics, Answers, Sign In with Phone Number via Digits, Embedded Timelines with the Twitter Kit as well as the Tweet Composer to share on Twitter, and finally Native Ads from MoPub.

Cannonball is open source, so feel free to take a look at the code of Cannonball for iOS and Cannonball for Android on GitHub.

Digits Highlights

If you’re looking for an example of how to use Digits in your Web application, there are two files in this project that are particularly interesting.

On the frontend, public/javascripts/cannonball.js is where the implementation lives for our implementation of the Digits JavaScript SDK on the Cannonball page. It initializes the Digits SDK in the browser with the consumer key, triggers the Digits login flow when the user starts to interact with the “Sign In with Phone button”, performs a request to the backend passing the right OAuth Echo headers, and eventually displays the phone number.

On the backend, routes/index.js is responsible for verifying the authentication and interacting with the Digits API. When the login is successful, the Digits API will return the user information, and this route file passes some JSON data back to the frontend to display the verified phone number.

Setup

  1. Clone this GitHub repository and make sure you have Node installed.
  2. Create a set of credentials for Digits by creating an app on Fabric.
  3. Create a config.json file using config.sample.json as a template. Fill in your Digits app information.
  4. Install the module dependencies from npm and run the application!
npm install
npm start

You can then go to http://localhost:3000 in your browser.

Contributors

License

Copyright 2015 Twitter, Inc. and contributors.

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

About

Cannonball for Web featuring an end-to-end Digits Web Demo in JavaScript and Node.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 40.6%
  • JavaScript 37.2%
  • CSS 22.2%