A super simple application demonstrating the external authentication in Bit6.
- Get the API Key and Secret at Bit6 Dashboard.
$ git clone [email protected]:bit6/bit6-token-generator-node.git
$ cd bit6-token-generator-node
$ npm install
Specify your Bit6 API key and secret using environment variables or a local .env
config file. The file should contain two lines:
BIT6_API_KEY=abc
BIT6_API_SECRET=xyz
Start the application
$ npm start
Your app should now be running on localhost:5000.
Make sure you have the Heroku Toolbelt installed.
$ heroku create
$ git push heroku master
or
Set Bit6 API key and secret:
$ heroku config:set BIT6_API_KEY=abc
$ heroku config:set BIT6_API_SECRET=xyz
You would normally generate an external token by doing a POST from your app client to your application server. To simulate this using curl
:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"identities": ["usr:john","tel:+12123331234"]}' \
http://localhost:5000/auth
The response should be a JSON object:
{
"ext_token": "..."
}
For more information about using Node.js on Heroku, see these Dev Center articles: