如何自动获取刷新令牌并替换为autodesk forge中的先前html

时间:2018-03-09 09:25:04

标签: autodesk-forge

我得知如何获得令牌。请问您有关于如何获取刷新令牌的任何教程吗?谢谢!我目前知道如何在查看器中显示模型,但是,令牌将每2小时到期。我在网上搜索如何获得令牌感到很沮丧。请你帮我这个吗?谢谢!

1 个答案:

答案 0 :(得分:0)

这两篇文章应该有所帮助。

About Refresh Token

Landing your Forge OAuth authentication workflow

当请求access_token时,您还将获得一个刷新令牌,该令牌将使您能够获得新的access_token,而无需用户再次登录。 根据您使用的编程语言和环境,您还可以使用我们的SDK来简化您的生活。 例如。在Node.js的情况下,你可以 npm install 我们的 forge-api 包,它具有请求access_token的必要功能

步骤如下:

1)将用户重定向到Autodesk登录页面(更改client_id和redirect_uri以匹配已注册Forge应用程序使用的值): https://developer.api.autodesk.com/authentication/v1/authorize?response_type=code&client_id=xxx&redirect_uri=xxx&scope=data:read

2)在您的应用程序中实现您为Forge应用程序的redirect_uri

指定的端点

3)使用你上面回来的令牌请求access_token https://developer.api.autodesk.com/authentication/v1/gettoken

4)当您需要新的access_token时,您可以使用gettoken端点也返回的refresh_token:https://developer.api.autodesk.com/authentication/v1/refreshtoken

相关问题