Search Unity

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

Discussion in 'Addressables' started by I_Jemin, Nov 27, 2019.

Thread Status:
Not open for further replies.
  1. I_Jemin

    I_Jemin

    Joined:
    Jul 31, 2014
    Posts:
    11
  2. EirikWahl

    EirikWahl

    Joined:
    Apr 7, 2018
    Posts:
    21
    I_Jemin likes this.
  3. I_Jemin

    I_Jemin

    Joined:
    Jul 31, 2014
    Posts:
    11
    EirikWahl likes this.
  4. RahulT

    RahulT

    Joined:
    Feb 15, 2019
    Posts:
    2
    Any updates on this topic?
    I was also looking for a similar solution.
    Thanks in advance!
     
  5. araki_yuta

    araki_yuta

    Joined:
    Jan 21, 2020
    Posts:
    14
    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)
     
    RahulT and EirikWahl like this.
  6. EirikWahl

    EirikWahl

    Joined:
    Apr 7, 2018
    Posts:
    21
    araki_yuta likes this.
  7. mrekuc

    mrekuc

    Joined:
    Apr 17, 2009
    Posts:
    116
    @EirikWahl @araki_yuta @RahulT @I_Jemin

    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.
     
    euphonic likes this.
  8. EirikWahl

    EirikWahl

    Joined:
    Apr 7, 2018
    Posts:
    21
  9. LE-Peter

    LE-Peter

    Joined:
    Sep 15, 2020
    Posts:
    44
    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.
     
  10. EirikWahl

    EirikWahl

    Joined:
    Apr 7, 2018
    Posts:
    21
    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!
     
  11. LE-Peter

    LE-Peter

    Joined:
    Sep 15, 2020
    Posts:
    44
    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..
     
Thread Status:
Not open for further replies.