OAuth Access Code working on Localhost but not working on server (e.g. nodechef)


OAuth Access Code working on Localhost but not working on server (e.g. nodechef)



I'm developing a Web App using React and Meteor JS.



On my localhost, I would call Patreon's Oauth API with a redirect link and after the user logs in and allows access to his profile, the user will be redirected to http://localhost:3000. From there I would get the access code from the URL and then make query calls to the API and it would work smoothly.



Because it works, I decided to test it on a actual server like nodechef.
To my surprise, after getting the code from the URL and using it to try to query the Patron OAuth paths via:


var promise = patreonOAuthClient
.getTokens(oauthGrantCode, redirectURL)


var result = await promise.then(function(tokensResponse) {

}

......

catch(function(err) {
console.error('error!', err)
})



I would get the following error on the server (nodechef) but not on my localhost server:


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 }



How do I solve this?



Or is this something I have to inform nodechef for them to setup something on their end???









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV