[Question] Add parameters for auth in Addressable remote load path?

I know how to setup remote path in profile but I don’t know how to add access token.

I don’t want to allow anonymous access on CDN.

What I want to do

Any ideas?

The case of adding a key in URL is explained here: Addressable Assets development cycle | Addressables | 1.5.1

PS: I am currently looking for a way to do the same, but for HTTP header. Please give me a hint if you have found a solution for that. :slight_smile:

1 Like

Thanks for Help! I will post updates if I found solution

1 Like

Any updates on this topic?
I was also looking for a similar solution.
Thanks in advance!

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)

2 Likes

See one possible solution here: https://discussions.unity.com/t/722316/40
(Similar to the suggestion from @araki_yuta )

1 Like

@EirikWahl @araki_yuta @RahulT @I_Jemin_1

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.

1 Like

Yes, we have done this successfully, using the method described in the link I provided in the previous post: https://discussions.unity.com/t/722316/40

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.

Good luck!

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

Thanks anyway, the battle continues…