For modifying headers, you probably need to dig into AssetBundleProvider.
Use Unity’s implementation as template add somewhere to modify header.
I would look at this for starter UnityWebRequest CreateWebRequest(IResourceLocation loc)
Has anyone done this succesfully? I have been trying the AssetBundleProvider route but the file always gets reset and I cannot seem to create a new one without conflicts. I really need to add an authorization header for the assetbundle. It is silly that we cannot do this making addressables completely unless they are public links.
Hey, is there any chance you’re able to go into a bit more detail about how you achieved this?
After a couple days last week working on my own AssetBundleProvider to add the ability to set a header, I’m still getting error 403 from the server.
A UnityWebrequest sent independantly of the addressable system will login with 200 success - this however doesn’t help with addressables.
I copied the AssetBundleProvider.cs file, in doing so got a lot of errors because this class uses a lot of methods/ fields from other classes that are internal.
So I also copied WebRequestQueue.cs
Removed AssetBundleRequestOptions from my AssetBundleProvider.cs file and fixed all other errors caused by internal accessors. Here’s where I’m at with it - https://hastepaste.com/view/Zkr0EhhCU
I’ve followed the request through, I believe at every step, and confirmed the correct cookie is being sent with the UnityWebrequest via a header, but the server returns 403.
As far as I can tell I’ve got all the settings set correctly (there are so damn many all over the place…).
Profile set to the remote server (Cloudfront if it matters)
AddressableAssetSettings set to use RemoteBuildPath/ RemoteLoadPath
AddressableGroups set to use RemoteBuildPath/ RemoteLoadPath, and AssetProvider + AssetBundleProvider set to use my version of the AssetBundleProvider class
I’m now completely stuck, and I’m not finding any new information in my google searches.
Sorry, this was 1,5 years ago, and I have moved on to other projects, so I don’t remember any more details. However, if your header is being sent correctly, then your error is probably in the data contained within it (and thus not Adressables/Unity-related)? And I am confused to why you call the HTTP header a “cookie”; note that my code/description was related to HTTP headers.
I have it setup so I can swap between a normal webrequest and a webrequest via Addressables, using the same data. Logs in ok with a normal webrequest, swap to the addressables and ‘403 Forbidden’. So I think the header data is fine…?
The web side of things is all super new to me, our backend has signed cookies for authing… and our backend dev said