Last modified: 2014-08-10 11:29:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 55928 - CORS docs for MediaWiki Web API?
CORS docs for MediaWiki Web API?
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Documentation (Other open bugs)
1.22.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
https://www.mediawiki.org/wiki/Manual...
:
Depends on:
Blocks: documentation
  Show dependency treegraph
 
Reported: 2013-10-20 02:26 UTC by MZMcBride
Modified: 2014-08-10 11:29 UTC (History)
5 users (show)

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


Attachments

Description MZMcBride 2013-10-20 02:26:21 UTC
I can't seem to find docs for using CORS in client-side JavaScript with MediaWiki's Web API. I looked at [[mw:CORS]].
Comment 1 MZMcBride 2013-10-20 02:27:37 UTC
If/when we have docs, we can get added to <http://enable-cors.org/resources.html> maybe.
Comment 2 Kunal Mehta (Legoktm) 2013-10-20 02:38:31 UTC
I started [[mw:Manual:CORS]] using an example that Roan posted at bug 20814 comment 15. Would be nice if someone who actually knew how this worked could improve it :)
Comment 3 PiRSquared17 2014-02-16 22:12:56 UTC
(In reply to Kunal Mehta (Legoktm) from comment #2)
> I started [[mw:Manual:CORS]] using an example that Roan posted at bug 20814
> comment 15. Would be nice if someone who actually knew how this worked could
> improve it :)

I added a snippet example.
Comment 4 PiRSquared17 2014-06-30 18:46:41 UTC
https://www.mediawiki.org/wiki/API:Cross-site_requests https://www.mediawiki.org/wiki/Manual:CORS https://www.mediawiki.org/wiki/Snippets/Cross-wiki_editing_with_CORS https://www.mediawiki.org/w/api.php says this:

origin - When accessing the API using a cross-domain AJAX request (CORS), set this to the originating domain. This must be included in any pre-flight request, and therefore must be part of the request URI (not the POST body). This must match one of the origins in the Origin: header exactly, so it has to be set to something like http://en.wikipedia.org or https://meta.wikimedia.org. If this parameter does not match the Origin: header, a 403 response will be returned. If this parameter matches the Origin: header and the origin is whitelisted, an Access-Control-Allow-Origin header will be set.

centralauthtoken - When accessing the API using a cross-domain AJAX request (CORS), use this to authenticate as the current SUL user. Use action=tokens&type=centralauth on this wiki to retrieve the token, before making the CORS request. Each token may only be used once, and expires after 10 seconds. This should be included in any pre-flight request, and therefore should be included in the request URI (not the POST body). 

What else is needed?

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


Navigation
Links