Adding Authorization header to ajax calls?
Submitted by coreywi on Wed, 04/24/2019 - 22:41
A page with a 'Fill in the Blanks' content-type is trying to POST to 'saveResult' on the server. My server's REST API requires an Authorization header to be included in order to process the request.
Can anyone tell me where I can hook into the ajax call to add to the header?
Fri, 05/03/2019 - 18:46
Not an easy question, it
Not an easy question, it seems.
Is there any events that I can hook into for iframe and div-based content types where I can execute a H5P.jQuery.ajaxSetup()?
I don't want to hack the H5P source because I'll lose it on the next update.
Mon, 05/06/2019 - 07:15
Hi Corey!You can use the
You can use the alter_scripts hook. Please check thr documentation at https://h5p.org/node/2692 for details for your host system.
Wed, 05/08/2019 - 21:00
I'm trying to integrate H5P
I'm trying to integrate H5P into a custom host - it's been a (almost) futile exercise. ;) So, there doesn't appear to be any alter_scripts capability.
Mon, 05/20/2019 - 09:32
What do you mean by "custom
What do you mean by "custom host" ? Have you written your own H5P integration ?
If you're using an existing integration the instructions are, like otacke said, here: https://h5p.org/node/2692.
If you have your own integration you have to add the scripts where you add the library files in your integration. Should be in alterLibraryFiles and when adding files to the view of H5Ps.
Wed, 05/22/2019 - 21:58
By custom host, I'm not
By custom host, I'm not meaning Moodle, Wordpress, etc. It's an in-house developed SPA website that needs to load the H5P infrastructure on-demand.
Turns out I can call into H5P.jQuery ajaxSetup to get an Auth header to be added to every ajax call from that point on. Took me a very long time to figure that out - namely when H5P.jQuery is loaded (and stable) to be able to make this call.