Unity Services Web API for asset download URLs giving 'unauthorized' as response

Hello,

I’m using Unity 6 and Digital Asset Manager in my application. I have a prefab uploaded to the Unity’s Asset Manager. I can see this prefab in the Asset Manager window of my Unity 6 application. I want to use the Unity’s Services Web API to manage this asset. First I make the POST request to this URL with projectId in the header to get the anonymous authentication idToken:

https://player-auth.services.api.unity.com/v1/authentication/anonymous

This returns me the idToken, sessionid etc. Then I make a GET call to get the download URLs of the asset:

https://services.api.unity.com/assets/v1/projects/{projectId}/assets/{assetId}/versions/{assetVersion}/download-urls

I provide the projectID, assetId and assetVersion in this command and also provide header:

Authentification => Bearer {idToken}.

The problem is that I receive “unauthorized” as response of this request. What am I doing wrong? I’m following all that’s mentioned here:

https://services.docs.unity.com/assets-manager/v1/#tag/Asset-management/operation/assets_v1_Assets_GetAssetDownloadUrlsAsyncV1

I have also attached my code here
New Text Document.txt (2.4 KB)

Hey!

Here are some steps you can take in order to generate a bearer token that has the valid permissions needed to interact with your project via the Asset Manager API: