te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>CORS Autodesk Tandem API - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

CORS Autodesk Tandem API - Stack Overflow

programmeradmin3浏览0评论

I have a frontend application deployed on Azure Static Web Apps and a backend on Azure App Service (Node.js with Express) both followed the Autodesk Tandem React 2 legged example and worked in local. The frontend needs to communicate with the backend to access Autodesk APS API's, but I receive a CORS error when making the request in production:

Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Tried several ways of enabling CORS in the azure Appservice with no luck.

app.use(cors({ origin: ";, credentials: true }));

Should I use the Autodesk Tandem SDK in a frontend app? How to avoid CORS issues?

I have a frontend application deployed on Azure Static Web Apps and a backend on Azure App Service (Node.js with Express) both followed the Autodesk Tandem React 2 legged example and worked in local. The frontend needs to communicate with the backend to access Autodesk APS API's, but I receive a CORS error when making the request in production:

Access to XMLHttpRequest at 'https://tandem.autodesk/api/v1/groups' from origin 'https://my-static-web-app.azurestaticapps' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Tried several ways of enabling CORS in the azure Appservice with no luck.

app.use(cors({ origin: "https://my-static-web-app.azurestaticapps", credentials: true }));

Should I use the Autodesk Tandem SDK in a frontend app? How to avoid CORS issues?

Share Improve this question asked Feb 17 at 17:54 Jesús RuizJesús Ruiz 1 New contributor Jesús Ruiz is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 2
  • "Tried several ways of enabling CORS in the azure Appservice with no luck." — It is Autodesk who has to give https://my-static-web-app.azurestaticapps permission to access their site. Not the other way around! – Quentin Commented Feb 17 at 17:56
  • This question is similar to: XMLHttpRequest cannot load XXX No 'Access-Control-Allow-Origin' header. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – Quentin Commented Feb 17 at 17:59
Add a comment  | 

2 Answers 2

Reset to default 1

you should use your backend as a proxy for making requests to the Autodesk Tandem API, especially if you are encountering CORS issues in production. Here's why:

CORS issues arise because the Autodesk Tandem API does not allow requests from your frontend origin directly. You can bypass this by configuring your backend (Node.js with Express) to make requests to the Autodesk API on behalf of the frontend. This way, your backend handles the CORS issue because it will not be blocked by the browser.

  • Set up a route in your backend that listens for requests from the frontend.
  • From the backend, make the request to Autodesk's API.
  • Return the response from Autodesk back to your frontend.

The Tandem Viewer should be CORS enabled. Can you try following:

  • clear your browser cache and try again.
  • If there is any error - can you capture the request in developer console and share details (incl. request and response headers) with me, pls? My contact details are jan.liska at autodesk.
发布评论

评论列表(0)

  1. 暂无评论