使用交叉请求获取 Forge 2-legged 身份验证 [英] Getting Forge 2-legged authentication using Cross request

查看:24
本文介绍了使用交叉请求获取 Forge 2-legged 身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个简单的 html 页面来显示要伪造的上传模型.为了初始化伪造查看器,它需要访问令牌.对于请求访问令牌,我在交叉请求上使用 2-legged oAuth(因为我在不同的域上进行 POST).但它不断收到错误没有 'Access-Control-Allow-Origin' 标头存在在请求的资源上".请有人告诉我我该怎么做才能成功获得访问令牌.

I'm trying to create a simple html page to display a uploaded model to forge. For initialize the forge viewer it required the access-token. For request the access token I'm using the 2-legged oAuth on a Cross request(because I'm making the POST on different domain).But it keep getting error "No 'Access-Control-Allow-Origin' header is present on the requested resource". Please some one can tell me what should I do to get the acces-token successfully.

推荐答案

如您所见,您无法通过客户端脚本获取 Forge Token,它会抛出此 CORS 错误.这是设计使然.

As you noticed, you cannot obtain a Forge Token via client-side scripting, it will throw this CORS error. This is by design.

我会推荐一个简单的服务器端身份验证,它非常直接部署此示例 本地:

I would recommend a simple server-side authentication, it's quite direct to deploy this sample locally:

  1. 安装 Node.js
  2. 下载项目
  3. 使用您的 ID & 设置变量秘密
  4. 运行项目

这篇关于使用交叉请求获取 Forge 2-legged 身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆