Digits is a free phone-number-based log in solution. This repository showcases how you can use Digits in a React application.
git clone https://github.com/AnSavvides/react-digits.git cd react-digits npm install grunt watchOpen src/ReactDigits.js and enter your consumer key inside the componentWillMount function where we first initialize Digits.
In another terminal window run a simple HTTP server locally:
python -m SimpleHTTPServer 8000Head over to localhost:8000 and you should be able to see this code in action.
- This is a front-end only implementation and it is assumed that you have written code to handle the validation logic in the back-end. See the
onLoginSuccessfunction insrc/ReactDigits.jswhere we make aPOSTrequest withJSONto a/user/verifyendpoint - Digits is not available as an npm package, but rather over CDN; because of that, we had to include the Digits web SDK over CDN & reference it in our
webpackconfiguration inexternals. As a side effect, this is stopping us from creating this solution as a reusable npm-installable component.
MIT