问题
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.
回答1:
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:
- Install NodeJS
- Download the project
- Set the variables with your ID & Secret
- Run the project
来源:https://stackoverflow.com/questions/39911487/getting-forge-2-legged-authentication-using-cross-request