Recommand · May 24, 2021 0

Viewer loadModel – route with JWT authentication

My current stack is React-Native that uses a WebView with forge(v7.15) in it. My API is a symfony API and it has a authenticated route that receives the filename and returns me a BinaryFileResponse based on the file.

Basically what I’m wanting to do is:

actual:
viewer = new Autodesk.Viewing.Private.GuiViewer3D(document.getElementById('forgeViewer'));
viewer.loadModel('API_URL/route/filename');

expected:
viewer = new Autodesk.Viewing.Private.GuiViewer3D(document.getElementById('forgeViewer'));
viewer.loadModel('API_URL/route/filename', jwtToken); //or something like that.

Atm, everything works fine.
But I want to change the route to be authenticated and I don’t know how I can do that, and if I can do that.
I have my JWT token saved on client-side and I want to pass it on header/or anything that helps me to achieve that.

Is there a way to use the loadModel and send a JWT token to the URL that viewer will try to load?