/wlsconnect

Primary LanguageCSSMIT LicenseMIT

If you found this repo useful, consider clicking the sponsor button near the top :) Sponsoring via GitHub is as little as $1/month and if you do not use banks or credit cards, there are crypto links included :)

CircleCI Build Status Crowdin GitHub license SteemConnect channel on Discord

SteemConnect v2

Install

Download and install Node.js >= 7.7.1 then run

npm install

Add config vars

BROADCASTER_USERNAME = Main Steem account holding posting permissions e.g 'steemconnect'
BROADCASTER_POSTING_WIF = Posting wif of the main account
JWT_SECRET = Random string
DATABASE_URL = PostgreSQL database URL
DEBUG = sc2:*
you'll want to npm i -g sequelize
and pg
then sequelize db:migrate
export STEEMD_URL=https://whaleshares.io/ws
export STEEMD_URL_SERVER=https://whaleshares.io/ws
export BROADCASTER_USERNAME=acc
export BROADCASTER_POSTING_WIF=wif
export JWT_SECRET=oowoowoo123
export DEBUG=sc2:*
export DATABASE_URL=postgres://root:root@localhost:5432/test2
export CSP_DEFAULT='whalesharesconnect.com',"'unsafe-inline'","'unsafe-eval'"
export CSP_SCRIPT_SRC='whalesharesconnect.com',"'unsafe-eval'"
export CSP_CONNECT_SRC='*',"'unsafe-inline'","'unsafe-eval'"
export CSP_FRAME_SRC='whalesharesconnect.com',"'unsafe-inline'","'unsafe-eval'"
export CSP_STYLE_SRC='whalesharesconnect.com',"'unsafe-inline'","'unsafe-eval'"
export CSP_IMG_SRC='whalesharesconnect.com',"'unsafe-inline'","'unsafe-eval'"
export CSP_FONT_SRC='whalesharesconnect.com',"'unsafe-inline'","'unsafe-eval'"
create a db postgres user root pass root and a database test2 first

Run

npm start

Demo

Test demo app here: https://steemit.github.io/example-steemconnect-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.