Getting 403 Response from Autodesk Derivative API When Fetching Derivative from Cloudflare Workers

62 views Asked by At

I am facing an issue whith fetching data from the Autodesk Derivative API when using Cloudflare Workers. I am trying to download a file from this API like it is described in the Autodesk Tutorial (Step 3): Derivative Tuorial

The request works perfectly when made from localhost, but constantly results in a 403 response when made through Cloudflare Workers. Requests to https://developer.api.autodesk.com/ work fine but the endpoint for downloading a file is different https://cdn.derivative.autodesk.com/... and doesn't work when called from Cloudflare Workers

Here's the code of the request:

export const fetchDerivative = async (
urn: EncodedUrn,
derivative: Urn,
token: Token) => {
const { cookies, url } = await signedCookies(urn, derivative, token)

const headers = cookies.map((value) => ["Cookie", value] as [string, string])
//FIXME: returns 403 when request from remote worker
const res = await fetch(url.url, {
  headers: headers
})

return res}}

It is confirmed, that the required parameters for the request are valid.

I have confirmed that the acess token, cookies, etc. are valid and have also checked Autodesk Derivative documentation but there are no specific restrictions mentioned regarding requests from Cloudflare Workers.

Any insights into why I might be getting a 403 response only when using Cloudflare Workers would be greatly appreciated. Thank you!

0

There are 0 answers