Add steemconnect login option to your Node.js site FASTER than ever

Words
254
Reading
2 min
Listen
Play
8y

stmcon.png

Repository

https://github.com/nodejs/node
https://github.com/KoliaPotap/steemit-login

What Will I Learn?

  • You will learn how to add SteemConnect login option
  • You will learn how to do it in efficient way

Requirements

  • Installed Node.js and npm
  • Premade default file system, like this
    Screenshot_13.png

Difficulty

  • Basic

Tutorial Contents

  • Thanks for passport.js and passport-steemconnect.
    I can't remember how long it took me to make steemit login option, but it wasn't 1 hour, I wasted a couple days because one mistake.

Hope this file will speed up your development

This commitment is like one liner - copy paste and relax))


Copy paste things from app.js

Get views/layouts/main.handlebars code of steemit button

Get image from public/img

Then change SteemConnect settings. Change client id setting and client secret. You will get it from https://steemconnect.com/dashboard, LOGIN ad buy for 3 steem autorisation.

Change Redirect URI(s) to http://localhost:8080/auth/oauth/oauth2/callback

app.js : 53th line

passport.use(new SteemConnectStrategy({
authorizationURL: https://v2.steemconnect.com/oauth2/authorize,
tokenURL: https://v2.steemconnect.com/api/oauth2/token,
clientID: 'YOUR CLIENT ID',
clientSecret: 'YOUR CLIENT SECRET',
callbackURL: http://localhost:8080/auth/oauth/oauth2/callback,
scope: ['login'],
},
function(accessToken, refreshToken, profile, cb) {
return cb(null, profile);
} ));

AFTER 15 september v2 will be depricated. Delete v2

ofcourse after this add to package.json this

"dependencies": {
"async": "^2.6.1",
"body-parser": "^1.17.1",
"cookie-parser": "^1.4.3",
"cookie-session": "^2.0.0-beta.3",
"crypto": "^1.0.1",
"express": "^4.15.2",
"express-handlebars": "^3.0.0",
"express-session": "^1.15.6",
"json": "^9.0.6",
"method-override": "^2.3.7",
"passport": "^0.4.0",
"passport-steemconnect": "^1.1.0"
}

And do npm install in cmd (comand line)

Proof of Work Done

Add steemconnect login option to your Node.js site FASTER than ever | Ecency