Last modified: 2014-02-19 13:06:51 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 T62195, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 60195 - Warning message is unclear when using a callback parameter while trying to get a token
Warning message is unclear when using a callback parameter while trying to ge...
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.23.0
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://www.codecademy.com/courses/web...
aklapper-moreinfo
:
Depends on:
Blocks: documentation
  Show dependency treegraph
 
Reported: 2014-01-18 06:47 UTC by Diwanshi Pandey
Modified: 2014-02-19 13:06 UTC (History)
6 users (show)

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


Attachments

Description Diwanshi Pandey 2014-01-18 06:47:44 UTC
Intention:
I wanted to get the edit token of a Wikipedia:Sandbox page to edit it through Codecademy.

Steps to Reproduce:
1. I made a tutorial on codecademy for wikipedia API to get the edit token of a Wikipedia:Sandbox page
2. The link to the tutorial is : http://www.codecademy.com/courses/web-intermediate-en-BLea4/4/1

Actual Results:  
The api is returning a warning saying : "Unrecognized value for parameter 'intoken': edit"

Expected Results:  
There is not a clear message when using a callback parameter while trying to get a token

Reproducible: Didn't try
Comment 1 Umherirrender 2014-01-18 09:19:38 UTC
The documentation for the callback parameters includes the sentence "For safety, all user-specific data will be restricted.", this includes also tokens from prop=info, why 'edit' is not a valid value for intoken in that situation.

Same for action=tokens.
Comment 2 Umherirrender 2014-01-18 18:36:13 UTC
When you are on a mediawiki page, you can use mw.user.tokens.get('edittoken') to get a token.

When you are on a mediawiki page, you can get a token also over mw.api.getToken, have a look at mediawiki.api.js to see, how this module will do it. The following comment was found in that file:

// Due to the API assuming we're logged out if we pass the callback-parameter,
// we have to disable jQuery's callback system, and instead parse JSON string,
// by setting 'jsonp' to false.

maybe that helps
Comment 3 Andre Klapper 2014-02-11 13:41:23 UTC
Diwanshi: Do Umherirrender's comments help sufficiently? Or are there more clarifications you would like to see in the documentation? If so, what?
Comment 4 Diwanshi Pandey 2014-02-19 12:47:33 UTC
(In reply to Andre Klapper from comment #3)
> Diwanshi: Do Umherirrender's comments help sufficiently? Or are there more
> clarifications you would like to see in the documentation? If so, what?

Andre: Yes Umherirrender's comment helped in understanding the problem. As i am not using mediawiki instance so can't use mw.api.getToken. Sorry for replying so late.
Comment 5 Bawolff (Brian Wolff) 2014-02-19 12:53:17 UTC
(In reply to Diwanshi Pandey from comment #4)
> (In reply to Andre Klapper from comment #3)
> > Diwanshi: Do Umherirrender's comments help sufficiently? Or are there more
> > clarifications you would like to see in the documentation? If so, what?
> 
> Andre: Yes Umherirrender's comment helped in understanding the problem. As i
> am not using mediawiki instance so can't use mw.api.getToken. Sorry for
> replying so late.

I still think there is a (low-priority) bug here, as we shouldn't return a "parameter doesn't exist" error for a "parameter disabled" error. Error messages should reflect their actual causes, otherwise it confuses people.

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


Navigation
Links