javascript - 如果我将我的应用程序重定向到 Next JS 页面,我们可以提取 Next JS 页面中的标题吗?
问题描述
我正在研究 intuit-oauth 并意识到我不能对我的 'api/auth/qb' 执行 axios.get ,它将我重定向到在后端生成链接的授权页面。它引发了 CORS 错误,并且 intuit 团队在论坛中表示他们不支持客户端 oauth(https://help.developer.intuit.com/s/question/0D50f00005pP1e5/cors-error-while-getting -access-token-using-url-httpsoauthplatformintuitcomoauth2v1tokensbearer),因此出现错误。
错误:
Access to XMLHttpRequest at 'https://appcenter.intuit.com/connect/oauth2?client_id=<MY_CLIENT_ID>&redirect_uri=<MY_REDIRECT_URI>&response_type=code&scope=com.intuit.quickbooks.accounting%20openid&state=<MY_STATUS>' (redirected from 'http://localhost:3000/api/auth/qb') from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
the next js pages structure:
pages
--index.tsx
--dashboard.tsx
--api
|--auth
|--qb.tsx
因此,我计划在获得访问令牌并在标头中发送访问令牌后,将用户从后端重定向到“/dashboard”,然后如果我可以在 nextJS 页面中提取代码,我会将其存储在local storage,所以问题是:我可以在下一个 js 页面上提取它吗?如果可以,如何提取?
解决方案
推荐阅读
- pandas - 读取文件,其中分隔符在文件本身内使用 read_csv 更改
- angular - 无论如何要恢复在 ag-grid-community V20 中引入的多标题组显示更改?
- python - 如何处理 Cv2/.dylibs/QTGui 和 LibQcocoa/LibQt5Print Support 中实现的类?
- python - 重复表单数据到 Django 表单
- postgresql - 尝试创建表忽略或未执行 postgresql
- mysql - 如果不存在则插入不插入
- regex - 要捕获的正则表达式:word {word} word
- docker - 在 docker 中运行两个服务节点和 python
- r - 使用 WSL 在 R 中运行 Linux 可执行文件
- firebase - 我可以信任提供给 functions.https.onCall 函数的用户信息吗?