Hi all. I got an 401 (Unauthorized) to all my asset url I’m using at approximately 16:00 26.10.2023 so all my HTMS / CSS ui fall a part. I’m using this to get urls
console.log("url('https://playcanvas.com/api/" + this.printAssetURL["_file"]["url"]+"')");
is something changed today? I’ve tried on different internet connections and devices, same issue.
could you provide more details? have you lost access in the editor? or in playcanvas-sync? Could you share a project URL?
this is project example of how I use to get access to asset urls. Now it does not works and I seems figutred out. for some reason assets moved to new url and both
this.myAsset["_file"]["url"] return old url. My question is should I work around this issue by processing old url or issue will be fixed?
one generated by code
one copped from source inspector in browser
//https://playcanvas.com/api/assets/155616050/file/underwater-magic-world-8tyxt9yz.jpeg?branchId=0d6c0523-6d95-491e-a169-70b14469b409&t=8170facdbc54288dea63307ce37a94cf this works
please use getFileUrl() to get asset URL, as documented, e.g. console.log(this.image.getFileUrl());
getFileUrl() returns correct URL for the launch page when you launch a project in the editor (launch.playcanvas.com), not main website (playcanvas.com).
Oh this is why… Thakns a lot. correct working cod looks like
rule.style.backgroundImage = "url('https://launch.playcanvas.com" + this.iconAssets[iconIndex].getFileUrl() +"')";
be careful, because this script will work on the launch page, but will not work when you export your project and run it from your own server - these URLs should be relative.