1

我正在尝试自定义 oauth2orize all-grants 示例以供我使用。我可以按原样运行所有授权,并且一切正常(如您所料),但是当我运行我的自定义版本时,我总是会遇到以下错误:

Error: Unable to issue redirect for OAuth 2.0 transaction
at Object.response [as handle] (C:\Dev\Expy\api\node_modules\oauth2orize\lib\grant\code.js:122:41)

我已经对此进行了深入研究,似乎该函数中有一个 txn 变量的属性,该属性应命名为 redirectURI ,并且应使用从初始请求到 /dialog/authorize 页面的查询字符串中的 redirect_uri 填充. 出于某种原因,这不会发生在我的示例应用程序上。这是由快递版本差异引起的吗?这是我在示例代码和我的自定义项之间看到的最大区别。all-grants 使用 express 2.*,我的应用程序将使用 express 4.*。

如果不是快速版本问题,我应该从哪里开始在我的代码中查找问题?

作为参考,这是我在我的应用程序中看到的 txn 对象:

txn: {
    "transactionID": "evlUd2q4",
    "client": { ... },
    "req": {
        "type": "code",
        "clientID": "5C3B4438-433F-11E5-A532-74653C701F13"
    },
    "user": { ... },
    "res": {
        "allow": true
    }
}

这就是我在与示例相同的对象中看到的内容(注意 req 和 txn 本身中存在 redirectURI):

txn: {
    "transactionID": "EEcYp3Uj",
    "client": { ... },
    "redirectURI": "http://localhost:3000/api/userinfo",
    "req": {
        "type": "code",
        "clientID": "abc123",
        "redirectURI": "http://localhost:3000/api/userinfo"
    },
    "user": { ... },
    "res": {
        "allow": true
    }
}
4

0 回答 0