OBJFileLoader token option

It would be nice if OBJFileLoaders ImportMesh would accept and pass down additional parameter to load files from protected endpoints.
In my usecase i’m getting auth string from API response for obj file like “…/*.obj?someAuthString”. afterwards i’m isolating that auth string and passing it down ImportMesh->ImportMeshAsync->_parseSolid.
Inside loadmtl i’m adding auth string to all files…

pinging @Drigax

Hey @Marin_Pericic I don’t understand, why does this need to be part of the OBJ loader? Can you check to see if this already work when loading glTF files? I’d expect everything that requires an auth string to fail similarily

Can you use Tools.PreprocessUrl to add the authentication to the url?

1 Like

Not sure but i doubt, i haven’t seen anything in parseMTL function that would append any type of token/auth string to materials used. .mtl by default has relative file names inside it, in case of using auth string it should be parsed and changed accordingly.

Every url that is loaded in Babylon.js is supposed to go through Tools.PreprocessUrl. The reason why this function exists is because of authentication.

1 Like

Ohh, i didnt know that, my bad, when i bumped into need to take care of that no one pointed me that way. THANKS!