Last modified: 2013-10-10 18:50:22 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57579, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55579 - Special:MWOAuth/initiate returns non-standard JSON
Special:MWOAuth/initiate returns non-standard JSON
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
OAuth (Other open bugs)
master
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-10 18:21 UTC by Merlijn van Deen (test)
Modified: 2013-10-10 18:50 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Merlijn van Deen (test) 2013-10-10 18:21:08 UTC
Flask-OAuth [1] expects a response like

{
   "oauth_token":"...",
   "oauth_token_secret":"..."
}

which, is apparently fairly standard, as it's used by both Twitter and Facebook.

Special:MWOAuth/initiate, however, returns 

{
   "key":"...",
   "secret":"..."
}


As a workaround, I have patched Flask-OAuth:

import flask_oauth, json
def parse_response(resp, content, strict=False):
    ct = json.loads(content)
    print ct
    return {'oauth_token': ct['key'], 'oauth_token_secret': ct['secret']}

flask_oauth.parse_response = parse_response



[1] http://pythonhosted.org/Flask-OAuth/
Comment 1 Brad Jorsch 2013-10-10 18:42:45 UTC
What exactly are you using as an endpoint URL? When I test it here, I can only reproduce this if the (non-standard) format=json is included. Omitting that parameter appears to properly return a application/x-www-form-urlencoded body with the field names, as called for in RFC 5849 section 2.1.
Comment 2 Merlijn van Deen (test) 2013-10-10 18:50:22 UTC
Ah, I had based myself on https://www.mediawiki.org/wiki/User:CSteipp/OAuth_demo_client . Leaving off the &format=json seems to work correctly. Thanks!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links