This is THE most helpful tutorial to exist. Thank you!
I do have one question though:
After requesting the refresh token with the code, my url only redirects with the same code. This is difficult to explain, but I am able to return all data except the refresh token. (CAN get username and access token)
This is my code:
router.get('/', function(req, res, next) {
let code = req.query.code;
if (code) {
return rp({
method: "POST",
uri: "https://steemconnect.com/api/oauth2/token",
body: {
response_type: "refresh",
code: code,
client_id: "appname",
client_secret: process.env.SC_CLIENT_SECRET,
scope: "vote"
},
json: true
}).then((results) => {
//let qs = "access_token=" + results.access_token + "&refresh_token=" + results.refresh_token + "&username=" + results.username;
res.render('customize', { title: "appname", username: results.refresh_token, refresh_token: results.refresh_token });
// results.refresh_token returns undefined?
});
}
});
Any help would be much appreciated. Thanks!
RE: Tutorial: OAuth2 Access Tokens and Refresh Tokens with Steemconnect