CORS Permsision
Closed this issue · 4 comments
Tried to import across multiple wiki sites, and run into the following error in console
Access to fetch at 'https://pathfinderwiki.com/api.php?action=query&prop=revisions%7Cpageprops&rvprop=content&maxlag=5&rvslots=main&origin=*&format=json&redirects=true&titles=Minata' from origin 'http://localhost:30000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
That's is unfortunately something that cannot be avoided with some wiki sites, pathfinderwiki being one of them. This is because javascript run from a browser, which includes all foundry modules, is bound by CORS policies for safety purposes. It cannot be opted out.
Fortunately you can still import from pathfinderwiki(and most others that fail with this error) with few additional steps.
On the wiki site choose "View source"
There you can copy everything from this box:
Finally in the import window paste the source you just copied, and fill in the wiki name, like this:
Be sure to leave first field empty!
You have to fill Wiki domain only once, it will remember last selection for future pages.
Access to XMLHttpRequest at 'https://login.microsoftonline.com/98f7abd1-7e17-4950-8e4e-cb3286fbd5f9/oauth2/v2.0/authorize?client_id=57fbb0aa-1755-4e08-aed7-8876c9297bcc&redirect_uri=https%3A%2F%2Fcmappuat.dcpmidstream.com%2F&response_mode=form_post&response_type=id_token&scope=openid%20profile&state=OpenIdConnect.AuthenticationProperties%3Dk1bZdN6OizoRaDIxiwgIOLbaGFdAX4sfO85kCdExuFNXccWvYQce03vGJbESQoqwJ2SWFvF9W5HOI2VU23H9-v37PDIzqsCCgoQMUXkRUMI0vvstfrdGtIjTSCRZ9pEa42eXWKnStxBBgMD3m1b5FGSOcbeNBYJCYZae2KRX9YGfpPTOF7bAd4E155A4_gpLCM1TbrfA2dBDCLVlQq9Z_w8uy4HSfYvPMIEkzfQH20bIqV3en6n_9TrD6peFmSuTfdzVcgJGlebEY3dNhB19HQ&nonce=637659170787122894.MzU1NWQ0OTEtNjRjNC00Zjc2LWFjODgtZmQzNGExNDI2OTVjYjg0YzVjOTgtNWIzZC00NTMxLTlhZDktOTYwZDQ4ODBiZGUw&x-client-SKU=ID_NET461&x-client-ver=5.3.0.0' (redirected from 'https://cmappuat.dcpmidstream.com/searchticket/GetSearchScreen/') from origin 'https://cmappuat.dcpmidstream.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Please help how to resolve this issue @SpinachInquisition
@Clementinagurjar I'm sorry, this doesn't seem to be a wikipedia article link. Are you sure you posted it at right repo?
I've added more info on CORS in the module and on the wiki https://github.com/rlach/wiki-import/wiki/About-CORS
I hope those are a help to you and make the module easier to use.