<html> <div> <center> <img src="https://i.imgur.com/6zvBBMM.png"> </center> <br> <center> <em> <strong> First, solve the problem. Then, write the code. </strong> <br> <em>-"John Johnson".</em><br> <sub>fortrabbit.github.io/quotes</sub> </em> <br> </center> <p> </p> <div> <div class="pull-right"> <img src="https://78.media.tumblr.com/3d6a33fd232b15653d9ea6427e4e7cdd/tumblr_ohh98sIjw41vr75k3o1_500.gif"> </div> <strong>What's up guys!</strong> I recently started a steemit project by myself and I thought I could do a little introduction to the <a href="#">Steemconnect V2</a> library, in case it helps someone else. <br><br> <strong>So let's stop the talk and let's get into it.</strong> <br><br> First of all. You need to <a href="#">configure Steemconnect v2</a>. So I will leave here a link, in witch it tells you step by step how to do it properly. <br><br><a href="https://busy.org/@noisy/how-to-configure-steemconnect-v2-and-use-it-with-your-application-how-it-works-and-how-it-is-different-from-v1">How to configure SteemConnect v2 - By @noisy</a> <br><br> Once the APP is set from <a href="https://v2.steemconnect.com/login"> Steemconnect </a> we can begin to prepare the environment that we will need. <br><br> <center> https://steemitimages.com/DQmdYE66KsdUJ7erQoUPuMErfk36K664MNDTAAHLzvvJTzu/m81kCVH.png </center> <br> <center> Before setting the main code, we will need to install <strong>2 NPM packages</strong>. <br> Them are: <a href="#">npm install cross-fetch --save</a> <br> <a href="#">npm install js-cookie --save</a></center> <br> <center>Basically seems like the SC2.JS API needs the cross-fetch package, and we will need the Cookie one, to get access to the 'access_token' in our entire site.<br><sub>With this ready, let's move to our next step.</sub></center> <br><br> <center>After this, we just need to initialize our SC2 API. So for that, just create another file, import the SC2 API, and set this next code. <br><br> https://steemitimages.com/DQmdTyJWF5yaDQaNHmA2B52ZQtK9cx88mDuuaZiZWbMHNf5/Screen%20Shot%202018-04-26%20at%2019.16.28.png <br><br> <strong>Edited: on scope, 'login' is an invalid scope. So guys, don't set it as I did.</strong> <br><br> With this ready, we just need a way to <strong>GET</strong> the <a href="#">link that the user needs to login with SteemConnect</a>. For that, the <strong>API provides us with 2 methods</strong>. Both them are for authentication. One of them provides the main link to login, and the other one, just revokes the token, and logs out the user. <br><br> https://steemitimages.com/DQmU5bWMGWQkdtDfYNMd5ei64A1puxoWVri5t9mqX2wDz6u/Screen%20Shot%202018-04-26%20at%2019.22.23.png <br><br> As you can see in the <strong>revokeToken method</strong>, we use the <a href="#">Cookie.remove('access_token')</a>. Basically the Cookie package will help us to get the main 'access_token' to the entire site, or remove it in case we don't need it anymore. <br><br> <strong>Right now we just need a way to set the 'access_token'</strong>. I will provide you with my own method. Im sure you can improve it and use regex in a better way, but for now im sure this one will works perfectly for you. <br><br> https://steemitimages.com/DQmQZzbjLvmccZPUqT3LqxZmYCGbKNqUEnLAvoEArArkGg2/Screen%20Shot%202018-04-26%20at%2019.27.38.png <br><br> Damn, a lot of promises. Im sure you can delete most of them, and clean this code a bit. But basically, <strong>after the user hits the /success url path, we initialize this method in our componentDidMount</strong>. <br><br> Basically we are <strong>extracting the 'access_token' and setting it to our global Cookie</strong>. With that, we are ready to get all the info that the steem blockchain has to offer for us. <br><br> <center> https://steemitimages.com/DQmdYE66KsdUJ7erQoUPuMErfk36K664MNDTAAHLzvvJTzu/m81kCVH.png </center> <br> After this, we just need to call our setAPIToken in our componentDidMount. <br><br> https://steemitimages.com/DQmW6Ksus4MD42wJvF8D7RMndqjaqHSKpP7qp69UZznUCwZ/Screen%20Shot%202018-04-26%20at%2019.34.14.png <br><br> And if we did things right, with the API.me() method, we will be able to get all the info that the blockchain provides from the logged in user. <br><br> https://steemitimages.com/DQmYMbBjUYM1ddk8hcWqjZ9pB9Ru8BSxHiuzGPqZbF7vPEw/Screen%20Shot%202018-04-26%20at%2019.40.47.png <br><br> <center> https://steemitimages.com/DQmdYE66KsdUJ7erQoUPuMErfk36K664MNDTAAHLzvvJTzu/m81kCVH.png </center> <br> <center>So this is all guys. I'm a newbie developer, so for sure this code can be improved much more. If you all wanna suggest something, or wanna know anything else about the above example, just ask. <br><br> <strong>Hope you liked this post, and helped you a bit. See you in the next one! Have a great day everyone!</strong> <br><br> <sub> <br>The thumbnail of the post, was created by me. The gifs of this post, does not belongs to me.<br> This post was created on steemit.com. As i know on busy.org, the posts didn't looks in the same way. So if you wanna enjoy it, i fully recommend taking a look at the post here on Steemit. <br> Thanks you! <br> @selected </sub> </center> </center> <center> </html>
author | selected |
---|---|
permlink | setting-up-steemconnect-v2-with-react-js |
category | utopian-io |
json_metadata | {"tags":["utopian-io","steemit","programming","dev","steemdev"],"users":["selected"],"image":["https://i.imgur.com/6zvBBMM.png","https://78.media.tumblr.com/3d6a33fd232b15653d9ea6427e4e7cdd/tumblr_ohh98sIjw41vr75k3o1_500.gif","https://steemitimages.com/DQmdYE66KsdUJ7erQoUPuMErfk36K664MNDTAAHLzvvJTzu/m81kCVH.png","https://steemitimages.com/DQmdTyJWF5yaDQaNHmA2B52ZQtK9cx88mDuuaZiZWbMHNf5/Screen%20Shot%202018-04-26%20at%2019.16.28.png","https://steemitimages.com/DQmU5bWMGWQkdtDfYNMd5ei64A1puxoWVri5t9mqX2wDz6u/Screen%20Shot%202018-04-26%20at%2019.22.23.png","https://steemitimages.com/DQmQZzbjLvmccZPUqT3LqxZmYCGbKNqUEnLAvoEArArkGg2/Screen%20Shot%202018-04-26%20at%2019.27.38.png","https://steemitimages.com/DQmW6Ksus4MD42wJvF8D7RMndqjaqHSKpP7qp69UZznUCwZ/Screen%20Shot%202018-04-26%20at%2019.34.14.png","https://steemitimages.com/DQmYMbBjUYM1ddk8hcWqjZ9pB9Ru8BSxHiuzGPqZbF7vPEw/Screen%20Shot%202018-04-26%20at%2019.40.47.png"],"links":["#","https://busy.org/@noisy/how-to-configure-steemconnect-v2-and-use-it-with-your-application-how-it-works-and-how-it-is-different-from-v1","https://v2.steemconnect.com/login"],"app":"steemit/0.1","format":"html"} |
created | 2018-04-26 19:30:33 |
last_update | 2018-04-26 19:34:12 |
depth | 0 |
children | 6 |
last_payout | 2018-05-03 19:30:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 38.356 HBD |
curator_payout_value | 7.538 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 5,204 |
author_reputation | 5,342,944,151,905 |
root_title | "Setting up "SteemConnect V2" with React.js" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 52,317,273 |
net_rshares | 7,305,030,999,399 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
berniesanders | 0 | 3,046,720,174 | 2% | ||
nextgencrypto | 0 | 53,267,252,175 | 2% | ||
steemservices | 0 | 4,569,870,852 | 2% | ||
ubg | 0 | 305,334,630 | 1% | ||
tfeldman | 0 | 23,710,981,175 | 38% | ||
thecyclist | 0 | 27,057,191,045 | 2% | ||
yougotflagged | 0 | 8,442,285,349 | 2% | ||
selected | 0 | 0 | 0% | ||
jerrybanfield | 0 | 1,278,358,089,523 | 8.32% | ||
gktown | 0 | 91,812,758 | 0.56% | ||
resteemable | 0 | 969,241,243 | 1.12% | ||
henryn2020 | 0 | 3,379,207,508 | 50% | ||
olyste | 0 | 504,860,548 | 100% | ||
chanceb | 0 | 0 | 100% | ||
thedelegator | 0 | 7,926,777,605 | 2% | ||
juicypop | 0 | 1,298,012,048 | 25% | ||
abcbullion | 0 | 479,315,115 | 78% | ||
perthmint | 0 | 479,312,952 | 78% | ||
steemabuse | 0 | 429,185,734 | 70% | ||
buildawhale | 0 | 1,869,909,946,389 | 2.27% | ||
wuhotan | 0 | 6,020,385,423 | 1.33% | ||
upme | 0 | 3,966,268,585,322 | 6.27% | ||
ngc | 0 | 7,647,213,742 | 2% | ||
zerocreative | 0 | 600,877,525 | 100% | ||
dayatsiaulia | 0 | 2,046,781,368 | 100% | ||
kuzminaleksandrh | 0 | 67,806,950 | 100% | ||
tczajkowski | 0 | 501,800,787 | 100% | ||
mmouaz | 0 | 517,101,795 | 100% | ||
matildah | 0 | 2,425,019,191 | 10% | ||
murhadi9 | 0 | 281,114,960 | 100% | ||
qurator-tier-1-2 | 0 | 34,291,385,085 | 3.5% | ||
imurstory | 0 | 137,530,428 | 100% |
great tutorial sir @selected. Go on sir.
author | aant1563 |
---|---|
permlink | re-selected-setting-up-steemconnect-v2-with-react-js-20180426t193419809z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"users":["selected"],"app":"steemit/0.1"} |
created | 2018-04-26 19:34:27 |
last_update | 2018-04-26 19:34:27 |
depth | 1 |
children | 2 |
last_payout | 2018-05-03 19:34:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.042 HBD |
curator_payout_value | 0.011 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 40 |
author_reputation | 349,555,464,104 |
root_title | "Setting up "SteemConnect V2" with React.js" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 52,317,826 |
net_rshares | 9,046,746,865 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
selected | 0 | 9,046,746,865 | 100% |
Thanks sir : )
author | selected |
---|---|
permlink | re-aant1563-re-selected-setting-up-steemconnect-v2-with-react-js-20180426t202943141z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-04-26 20:29:42 |
last_update | 2018-04-26 20:29:42 |
depth | 2 |
children | 1 |
last_payout | 2018-05-03 20:29:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 14 |
author_reputation | 5,342,944,151,905 |
root_title | "Setting up "SteemConnect V2" with React.js" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 52,324,849 |
net_rshares | 0 |
welcome sir
author | aant1563 |
---|---|
permlink | re-selected-re-aant1563-re-selected-setting-up-steemconnect-v2-with-react-js-20180426t203254360z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-04-26 20:32:57 |
last_update | 2018-04-26 20:32:57 |
depth | 3 |
children | 0 |
last_payout | 2018-05-03 20:32:57 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.046 HBD |
curator_payout_value | 0.003 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 11 |
author_reputation | 349,555,464,104 |
root_title | "Setting up "SteemConnect V2" with React.js" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 52,325,224 |
net_rshares | 8,726,912,380 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
selected | 0 | 8,726,912,380 | 100% |
Thanks tell me I am resteem due to more peoples read # @selected
author | mmouaz |
---|---|
permlink | re-selected-setting-up-steemconnect-v2-with-react-js-20180426t193810108z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"users":["selected"],"app":"steemit/0.1"} |
created | 2018-04-26 19:38:12 |
last_update | 2018-04-26 19:51:15 |
depth | 1 |
children | 0 |
last_payout | 2018-05-03 19:38:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.042 HBD |
curator_payout_value | 0.011 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 64 |
author_reputation | 514,935,601,142 |
root_title | "Setting up "SteemConnect V2" with React.js" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 52,318,313 |
net_rshares | 8,863,984,303 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
selected | 0 | 8,863,984,303 | 100% |
**Your Post Has Been Featured on @Resteemable!** <br> Feature any Steemit post using resteemit.com! <br> **How It Works:** <br> 1. Take Any Steemit URL <br> 2. Erase `https://` <br> 3. Type `re`<br> Get Featured Instantly & Featured Posts are voted every 2.4hrs <br>[Join the Curation Team Here](https://goo.gl/forms/4sr0InoTxcyPRQSj2) | [Vote Resteemable for Witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=resteemable&approve=1)
author | resteemable |
---|---|
permlink | re-resteemable-setting-up-steemconnect-v2-with-react-js-20180426t220701235z |
category | utopian-io |
json_metadata | "" |
created | 2018-04-26 22:07:00 |
last_update | 2018-04-26 22:07:00 |
depth | 1 |
children | 0 |
last_payout | 2018-05-03 22:07:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 453 |
author_reputation | 711,299,530,826 |
root_title | "Setting up "SteemConnect V2" with React.js" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 52,336,650 |
net_rshares | 0 |
Thanks for sharing this great post sir@selected. Great tutorial..it's appreciate me sir. keep going sir.
author | sanjoy22 |
---|---|
permlink | re-selected-setting-up-steemconnect-v2-with-react-js-20180426t212131062z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-04-26 21:21:36 |
last_update | 2018-04-26 21:21:36 |
depth | 1 |
children | 0 |
last_payout | 2018-05-03 21:21:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.050 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 104 |
author_reputation | 285,915,584,994 |
root_title | "Setting up "SteemConnect V2" with React.js" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 52,331,295 |
net_rshares | 8,270,005,973 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
selected | 0 | 8,270,005,973 | 100% |