我正在使用React和Meteor JS开发Web应用程序。
在我的本地主机上,我将使用重定向链接调用Patreon的Oauth API,并且在用户登录并允许访问其个人资料后,该用户将被重定向到http://localhost:3000。从那里,我将从URL获取访问代码,然后对API进行查询调用,它将顺利进行。
因为它有效,所以我决定在像nodechef这样的实际服务器上对其进行测试。 令我惊讶的是,从URL获取代码并使用它尝试通过以下方式查询Patron OAuth路径后:
var promise = patreonOAuthClient
.getTokens(oauthGrantCode, redirectURL)
var result = await promise.then(function(tokensResponse) {
}
......
catch(function(err) {
console.error('error!', err)
})
我会在服务器(nodechef)上收到以下错误,但在我的本地主机服务器上却没有:
error! Body {
url: 'https://www.patreon.com/api/oauth2/token',
statusText: 'UNAUTHORIZED',
headers:
Headers {
_headers:
{ date: [Array],
'content-type': [Array],
'content-length': [Array],
connection: [Array],
'set-cookie': [Array],
'cache-control': [Array],
pragma: [Array],
'x-patreon-uuid': [Array],
'strict-transport-security': [Array],
'x-content-type-options': [Array],
'expect-ct': [Array],
server: [Array],
'cf-ray': [Array] } },
ok: false,
body:
PassThrough {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 26,
pipesCount: 0,
flowing: null,
ended: true,
endEmitted: false,
reading: false,
sync: false,
needReadable: false,
emittedReadable: true,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events: { end: [Object], prefinish: [Function: prefinish] },
_eventsCount: 2,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: true,
ended: true,
finished: true,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: false,
allowHalfOpen: true,
_transformState:
{ afterTransform: [Function: bound afterTransform],
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: 'buffer' } },
bodyUsed: false,
size: 0,
timeout: 0,
_raw: [],
_abort: false }
我该如何解决?
或者这是我必须通知nodechef以便他们在其末端设置一些东西的地方吗?