Download and install Node.js >= 7.7.1 then run
npm install
Add config vars
BROADCASTER_USERNAME = Main dPay account holding posting permissions e.g 'dpayid'
BROADCASTER_POSTING_WIF = Posting wif of the main account
JWT_SECRET = Random string
DATABASE_URL = PostgreSQL database URL
DEBUG = dpid:*
npm start
Test demo app here: https://dpays.github.io/example-dpayid-angular/
/api/me - Get user profile (require user or app token)
/api/broadcast - Broadcast posting operation for user (require app token)
/api/oauth2/authorize - Issue new app token (require user token)
Tokens are created with JWT, the payload is public. Here is how it look:
{
role: 'user',
user: 'guest'
}
The token hash is saved on user localStorage once he login.
{
role: 'app',
proxy: 'example',
user: 'guest',
scope: ['vote', 'comment']
}
The token hash is sent to the application once user authorize the application.