oauth2.0 将forge-apis npm升级到0.9.6后,未调用V2身份验证URL

xn1cxnb4  于 12个月前  发布在  其他
关注(0)|答案(3)|浏览(75)

`
以前我使用的是v1身份验证和三条腿。现在,Autodesk宣布从10月30日开始,它将退役,因此我将forge-apis npm更新为0.9.6(https://www.npmjs.com/package/forge-apis/v/0.9.6),并将forge-apis的@types更新为0.9.0(https://www.npmjs.com/package/@types/forge-apis/v/0.9.0
我已经更新了库,即使URL被称为v1。

node-js代码片段:

import * as ForgeAPI from 'forge-apis';

let oa3Legged = new ForgeAPI.AuthClientThreeLegged(appConfig.accAuth.clientId,appConfig.accAuth.clientSecret,appConfig.accAuth.callback,['data:read', 'bucket:read', 'viewables:read', 'data:search'],true);

token = await oa3Legged.refreshToken(token).catch((error) => { aiLogger.traceError('error in refresh token method',{error});});

请帮我找出我做错了什么。

ovfsdjhp

ovfsdjhp1#

这是您这边的缓存问题。如果你运行which npm,它可能会指出本地路径,其中有一个旧版本可用,并且它是使用。
我所做的如下:
1.用which npm检查路径
1.通过$ sudo rm /user/local/bin/npm删除/usr/local/bin/npm
1.这将从您的环境中删除npm,您需要重新安装它。
1.我还删除了Node以获得它的新版本。重复步骤1和2,但将npm替换为node。
1.再次安装Node我使用的是brew install node,但你可以从网站上安装。
1.当检查which nodewhich npm时,它现在将有一个新的路径。
1.从缓存位置删除forge-apis文件夹。
1.运行npm install,以便安装新版本。
这将确保您使用的是平台的最新npm。

nimxete2

nimxete22#

要使用OAuth v2,在升级到forge-apis v0.9.6后,必须将Class从AuthClientThreeLegged更改为AuthClientThreeLeggedV2

let client = new AuthClientThreeLeggedV2(client_id, client_secret, callback_url, scopes);
92dk7w1h

92dk7w1h3#

现在,最新的更新包括对v2身份验证的支持。一旦我将@types/forge-apis的npm库更新到0.9.1,我们就可以使用v2身份验证的类。
let client = new AuthClientThreeLeggedV2(client_id,client_secret,callback_url,scopes);
因此,我们需要更新下面的库,以便使用v2身份验证。我1.https://www.npmjs.com/package/forge-apis/v/0.9.62.https://www.npmjs.com/package/@types/forge-apis/v/0.9.1

相关问题