Skip to content

dpays/dpayid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

852 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dPayID dApp

Install

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:*

Run

npm start

Demo

Test demo app here: https://dpays.github.io/example-dpayid-angular/

Api

Routes

/api/me - Get user profile (require user or app token)

/api/broadcast - Broadcast posting operation for user (require app token)

OAuth2

/api/oauth2/authorize - Issue new app token (require user token)

Tokens

Tokens are created with JWT, the payload is public. Here is how it look:

Token for user

{
  role: 'user',
  user: 'guest'
}

The token hash is saved on user localStorage once he login.

Token for application

{
  role: 'app',
  proxy: 'example',
  user: 'guest',
  scope: ['vote', 'comment']
}

The token hash is sent to the application once user authorize the application.

About

Token based authentication for dPay made easy

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • CSS 67.5%
  • JavaScript 32.4%
  • Other 0.1%