Three.js: GltfLoader crossOrigin='use-credentials' does not set withCredentials on FileLoader

Created on 29 May 2019  路  1Comment  路  Source: mrdoob/three.js

Description of the problem

We are using cookies to authenticate requests to a data store. GLTFLoader is used to load 3D models from this data store. We have been trying to set crossOrigin = 'use-credentials or setCrossOrigin('use-credentials');, however, cookies are not being sent to download the GLB/GLTF file.

From reviewing the code for GLTFLoader it appears that withCredentials is not being set on FileLoader when crossOrigin === 'use-credentials'. See these lines: https://github.com/mrdoob/three.js/blob/93e72ba7b24958ddb0652bd33171edd14ed2d693/examples/js/loaders/GLTFLoader.js#L66-L71

It appears that the solution is to check if crossOrigin === 'use-credentials and call loader.setWithCredentials(true) around line 70.

Three.js version
  • [] Dev
  • [x] r104
  • [x] r97
Browser
  • [x] All of them
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
OS
  • [x] All of them
  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] Android
  • [ ] iOS
Hardware Requirements (graphics card, VR Device, ...)
Bug Loaders

Most helpful comment

Should be taken care of by this PR:

https://github.com/mrdoob/three.js/pull/16601

>All comments

Should be taken care of by this PR:

https://github.com/mrdoob/three.js/pull/16601

Was this page helpful?
0 / 5 - 0 ratings