Just a quick update to say I have now fixed the authentication issue my PostToTumblr that quite a few people contacted me about.
What was going on was that Tumblr appear to have changed the format of the data they return from a token request which was causing a library that PostToTumblr relies on to fail.
Before PostToTumblr can post content on a users behalf it first must get an "access token". This token is given to PostToTumblr as part of the authentication flow.
When PostToTumblr first starts up it checks to see if it still has a valid token (they can expire over time and other various reasons). If it doesnt it must go through the authentication flow. Firstly it redirects the user to the grant permission dialog:
When the user clicks allow Tumblr then returns an "oauth token" and an "oauth verifier" to PostToTumblr, which it can then use to get an "access token" which is used to do the posting.
The problem that this update fixed was that the "oauth verifier" that was returned from Tumblr changed:
You see at the end of the query string there is now a "#_=_" well this was causing havoc with the URL parameter parsing code in the Google oauth library I was using.
My solution is quick and dirty, just strip out the "#_=_" from the url while parsing:
// MIKE HACK!!
if(param.indexOf('oauth_verifier=')!=-1)
{
param = param.replace('oauth_verifier=','');
param = param.replace('#_=_','');
decoded['oauth_verifier'] = ChromeExOAuth.fromRfc3986(param);
}
else
{
var keyval = param.split("=");
if (keyval.length == 2) {
var key = ChromeExOAuth.fromRfc3986(keyval[0]);
var val = ChromeExOAuth.fromRfc3986(keyval[1]);
decoded[key] = val;
}
}
Well I hope this helps anyone else that may encounter this issue too!
Drag. Looks like that oath issue has sprung up again. Only seems to be a problem for users that have more than one tumblr and try to switch between accounts using the Reset Account Authentication button. The extension gets stuck at the redirect page and authorization pops every time Chrome is opened. Any suggestions?
ReplyDeleteHmmm I havent tested that, ill take a look at it soon, cheers for reporting!
ReplyDeleteTried reinstalling the extension, deactivating other plugins, every minor step up to ...
ReplyDeleteRemoving all other Chrome extensions; clearing the browsing data including cookies, plugin data, and data from hosted apps; reinstalling the latest Chrome update, restarting the system; and installing only PostToTumblr.
That fixed it.
oh my, that seems rather extreme. Im away at the moment so its tricky for me to look into it but ill try as soon as I can..
ReplyDelete