3D Tileset from URL basic authentication

Hello community. I’m working with the Cesium Unity samples and I’m trying to connect to an on-premise 3D tileset server. I can get the projects to work with the Ion source but the on-premise URL requires basic authentication. I can see a “401” error in the console when I switch from Ion to URL (as I would expect). I created a separate Unity script that sets up the basic authorization header (username:password) and performs an http Get request. I’m able to successfully perform the request given the proper authentication header.

I tried disabling the CesiumGeoreference object in the Unity hierarchy and after the custom authentication script runs successfully (during runtime), I enabled the CesiumGeoreference object. When I do this, I don’t get the 401 error message but nothing seems to be happening. I’ve enabled “Log Selection Stats” in the Cesium 3D Tileset script but no activity is being logged.

I also observed that if I manually enable the CesiumGeoreference object in the editor after I hit play, the 401 error is not presented (whether or not I run my authentication script). It seems that this error message is only stimulated in the editor environment when updating the Url in the inspector.

Any suggestions for overcoming my URL authentication issues?

Thanks

Hi @Kevin_OB,

Try calling RefreshTileset on the Cesium3DTileset after completing your authentication. That should cause it to try connecting to the tileset again after you enable it. You might still have trouble with authentication, though. I assume your auth mechanism is setting a cookie, and expecting that cookie to be included in future requests. I don’t know whether Unity’s WebRequest will do that or not. Let me know how you go!

Kevin

Thanks for the reply. I tried invoking RefreshTileSet (from inspector button) after authentication. Still no debug messages. I modified scripts to run the authentication process within the Editor and then enable the Cesium3DTileset script. This resulted in the 401 error. I now realize that the problem with basic authentication is that each http request will require the authentication header (it won’t be magically cached like in a web browser). I’ll work with my onsite team to see about other authentication methods to our data. Thanks again!

As I go further down my journey…

What would be the recommended authentication flow for accessing an on-premise tile server (URL) within Unity via the Cesium3DTileset script?

Thanks.

The easiest thing is to use query parameters, if possible. If it’s not, you will probably need to modify Cesium for Unity to support your authentication mechanism.

I’m having the same issue with cesium for unreal.How can i solve it?