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

in #utopian-io6 years ago (edited)

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

Sort:  

Hi doelist,

  • Please edit your tutorial and put the template that we suggest here.
  • Please include the repository and proof of work done.

When you edit the tutorial please advise me to do the review.
Thank you.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @portugalcoin!

So far this week you've reviewed 26 contributions. Keep up the good work!

I did it. Please review

One more correction, please edit the tutorial and in the repository put github NodeJS.

Thank you.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you. You are cool.

ahahah Edit again and put this link in the repository: https://github.com/nodejs/node

Thank you.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your contribution.

  • Code sections are better displayed using the code markup.
  • We suggest that in the next tutorial explain in more detail how for example: app.js, passport.js ...

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

WOW, thanks.

Hey @doelist
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Shouldn't this be a development post instead of tutorial. There's no explanation of anything that you did. Like why use passport?

Why? Easiest method

Hi @doelist! We are @steem-ua, a new Steem dApp, computing UserAuthority for all accounts on Steem. We are currently in test modus upvoting quality Utopian-io contributions! Nice work!

Thanks)) I share what I had to offer.

As a follower of @followforupvotes this post has been randomly selected and upvoted! Enjoy your upvote and have a great day!

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 62102.06
ETH 2415.08
USDT 1.00
SBD 2.49