Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom headers to the XHR Request #338

Merged
merged 3 commits into from
Sep 7, 2021
Merged

Add custom headers to the XHR Request #338

merged 3 commits into from
Sep 7, 2021

Conversation

RossUK88
Copy link
Contributor

@RossUK88 RossUK88 commented Jul 9, 2021

I have a use case where I don't want to disable CRSF checking in my application and I want my API to resolve the current logged in user from their cookies that have been set.

I added 2 new settings to help achieve this, but set the defaults to be sensible so this should be a none breaking change.

I'm not sure if this is out of the scope of the package, and I realise my case is a bit of an edge case with how we are loading Scorm items but it solves my use case

RossUK88 and others added 3 commits July 9, 2021 08:49
 - Adds 2 new settings to BaseAPI, xhrWithCredentials and xhrHeaders.
  - xhrWithCredentials is set to false default to make this a non breaking change but will allow people to set this to try to send Domain Cookies
  - xhrHeaders gives the ability to add custom headers to the XHR Request to the LMS, allowing additional information to be sent
@jcputney jcputney merged commit 32e3d4f into jcputney:master Sep 7, 2021
@ahmadichsan
Copy link

ahmadichsan commented Sep 15, 2021

Hi @jcputney , thanks for the great package. I just installed the latest version, which is v1.6.1, to use the xhrHeaders settings. But, unfortunately, it didn't work. I try to check to the package in the node_modules, and I couldn't found the code to append the xhr headers as shown here https://github.com/jcputney/scorm-again/blob/master/dist/scorm-again.js

I'm using
"react": "^17.0.2",
"scorm-again": "^1.6.1",

when I try to "manually" edit the package inside the node_modules, it works. So, I wonder why I didn't get the latest files even the latest version is already installed.

I install using npm btw in case you need the information.

[UPDATE]
I solve the issue by install directly from this github repo, like this:

"scorm-again": "git+https://github.com/jcputney/scorm-again.git"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants