Closed xam-ps closed 6 years ago
cc @caisq is there a way to pass credentials (or other options to fetch)?
From MDN:
By default, fetch won't send or receive any cookies from the server, resulting in unauthenticated requests if the site relies on maintaining a user session (to send cookies, the credentials init option must be set).`
credentials: The request credentials you want to use for the request: omit, same-origin, or include. To automatically send cookies for the current domain, this option must be provided.
To pass credentials and other parameters for fetch
during tf.loadModel
calls, you can try the following.
await tf.loadModel(tf.io.browserHTTPRequest(url, {credentials: 'same-origin'}));
Still getting an 401.
Even gave credentials: 'include'
a try, didn't work either.
Just tested the solution from @caisq in Firefox, there it is working.
Issue was solved in Version 0.12.0
TensorFlow.js version
All versions
Browser version
All Browsers
Describe the problem or feature request
When served from a directory which is secured via .htaccess user and password the fetch function in "loadModel" is not working (response from server is 401). I think the function should use the option
credentials: 'same-origin'
.