Log In Using Steem Connect Connected via Steem Connect as | @{{username}} Log Out |
The purpose of this post is to help developers including myself to integrate Steem Connect. It would have helped me if it had existed before.
You can find this content at http://www.steemfiles.com/steemconnect_notes.html.
documentaiton of the function signatures only at:
In order to use the steemconnect API, you must first register your app over at their site.
I will not go through all of the time to put this as a github pull request. I am not going to beg for people to include this in the steemconnect github page. If they want it, let them beg me.
By taking the example, at https://github.com/bonustrack/bonustrack.github.io/tree/master/tutorials comments, and substituting your own parameters for steemconnect.init(), you can check whether steemconnect has the necessary configurations from you in order to use it. You will need to go to http://v1.steemconnect.com (no www) to seutp up your app.
Also please setup your app on v1.steemconnect.com not dev.steemconnect.com. [The] Dev branch is only used for the development of SteemConnect [itself].
-- @fabien
Once you login to Steem Connect you will find a button for 'Developers <>.' Click on that, and choose 'setup your app'.
All Steemconnect calls do not return anything but take callbacks. These callbacks each take two arguments in the following order: error, result. If there is an error in the call, the callback is called with error set to a message and the result is set to null. If the call succeeds, the error is set to null and the result is where the useful information is.
steemconnect.init({
The steemit.com username you logged in as in order to setup your app
baseURL: 'https://v1.steemconnect.com',
app: ,
The URL on your site, Steem Connect should redirect the user to after login
callbackURL:
Initializes the steemconnect object. It should be the first call made among other steemconnect routines.
});
steemconnect.getLoginURL();
Returns the URL the user must browse to in order to log in. The Log out URL is always:
https://v1.steemconnect.com/logout
steemconnect.isAuthenticated(callback);
Makes a request and calls callback with parameters
(err, null) on failure to get information or (null, result) on successful communication with the Steem Connect server.
When logging in, after entering the WIF or password you will get an RedirectUrl Mismatch error if the call back URL (with the path) is not listed in the Allowed redirect URLs
The Steem Connect server may deny your request with a 400 error if
isAuthenticated
: True if and only if we authenticated with Steem Connectusername
: The username authenticated with Steem Connecttoken
: A token, a program other than the browser can send to steemconnect in order to verify the same information. The token will remain valid for 24 hours.
This other program must send a HTTPS or HTTP GET request to
v1.steemconnect.com/api/verifyToken?token=" + token
in order to verify that a user has actually logged into Steem Connect as we cannot just trust the browser.
The program will receive a JSON string and its members are the following:
isValid
: true or false.username
: username of the user logged in
steemconnect.vote(voter, author, permlink, weight, callback);
Sets the vote weight for an author permlink combination. A complete vote has a weight of 10,000. A vote with weight 0 is considered the same as no vote at all.
The callback expects two parameters, err and result.
On success, the call back is called with err set to null and result set to an object with a single member: result
. Now this member result.result has the following members:
expiration : string
the expiration date in the following format: YYYY-MM-DDTHH:MM:SSextensions : Array
operations : Array
ref_block_num : int
ref_block_prefix : int
signatures : Array<string>