# Zoom-oauth-sample-app Unexpected token u in JSON at position 0

**URL:** <https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984>\
**Category:** API and Webhooks\
**Created:** [April 7, 2020, 7:56pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984 "2020-04-07T19:56:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnw](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jnw/32/5402_2.png) [@jnw](https://devforum.zoom.us/u/jnw)\
**Post date:** [April 7, 2020, 7:56pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/1 "2020-04-07T19:56:30Z")

</div>

**Description**  
Sorry for the n00b question.

In trying to follow the zoom-oauth-sample-app instructions, the POST instruction apparently returns an undefined body. Then JSON.parse fails in a way i don’t understand.

**Error**  
Zoom Hello World app listening at PORT: 4000  
SyntaxError: Unexpected token u in JSON at position 0  
at JSON.parse ()  
at Request.\_callback (/Users/jnw/Zoom/zoom-oauth-sample-app/index.js:33:25)  
at self.callback (/Users/jnw/Zoom/zoom-oauth-sample-app/node\_modules/request/request.js:185:22)  
at Request.emit (events.js:315:20)  
at Auth.onRequest (/Users/jnw/Zoom/zoom-oauth-sample-app/node\_modules/request/lib/auth.js:132:18)  
at Request.auth (/Users/jnw/Zoom/zoom-oauth-sample-app/node\_modules/request/request.js:1341:14)  
at /Users/jnw/Zoom/zoom-oauth-sample-app/index.js:87:12  
at Layer.handle [as handle\_request] (/Users/jnw/Zoom/zoom-oauth-sample-app/node\_modules/express/lib/router/layer.js:95:5)  
at next (/Users/jnw/Zoom/zoom-oauth-sample-app/node\_modules/express/lib/router/route.js:137:13)  
at Route.dispatch (/Users/jnw/Zoom/zoom-oauth-sample-app/node\_modules/express/lib/router/route.js:112:3)

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
OAuth

**Which Endpoint/s?**  
Knowing the API endpoint/s can help us to identify your issue faster. Please link the ones you need help/have a question with.

**How To Reproduce (If applicable)**  
Steps to reproduce the behavior:  
Request URL [https://zoom.us/oauth/authorize?response\_type=code&client\_id=gGdMwt7YRuODi12dDLRAQ&redirect\_uri=http%3A%2F%2F30f46877.ngrok.io](https://zoom.us/oauth/authorize?response_type=code&client_id=gGdMwt7YRuODi12dDLRAQ&redirect_uri=http%3A%2F%2F30f46877.ngrok.io)

**Screenshots (If applicable)**  
No fun screenshots. The error message tells it all

**Additional context**  
No add’l context

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 8, 2020, 8:39am UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/2 "2020-04-08T08:39:34Z")

</div>

Hey @jnw,

Can you try logging the req from this line?

> <https://github.com/zoom/zoom-oauth-sample-app/blob/master/index.js#L12>

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![jnw](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jnw/32/5402_2.png) [@jnw](https://devforum.zoom.us/u/jnw)\
**Post date:** [April 8, 2020, 12:53pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/3 "2020-04-08T12:53:58Z")

</div>

Thanks! Sure. Here it is (with the code slightly obscured).  
I’m about to look at it to see if I find anything odd, but I doubt I’d know.

req is:/ \<ref \*2\> IncomingMessage {  
\_readableState: ReadableState {  
objectMode: false,  
highWaterMark: 16384,  
buffer: BufferList { head: null, tail: null, length: 0 },  
length: 0,  
pipes: ,  
flowing: null,  
ended: false,  
endEmitted: false,  
reading: false,  
sync: true,  
needReadable: false,  
emittedReadable: false,  
readableListening: false,  
resumeScheduled: false,  
errorEmitted: false,  
emitClose: true,  
autoDestroy: false,  
destroyed: false,  
defaultEncoding: ‘utf8’,  
awaitDrainWriters: null,  
multiAwaitDrain: false,  
readingMore: true,  
decoder: null,  
encoding: null,  
[Symbol(kPaused)]: null  
},  
readable: true,  
\_events: [Object: null prototype] {  
end: [Function: resetHeadersTimeoutOnReqEnd]  
},  
\_eventsCount: 1,  
\_maxListeners: undefined,  
socket: \<ref \*1\> Socket {  
connecting: false,  
\_hadError: false,  
\_parent: null,  
\_host: null,  
\_readableState: ReadableState {  
objectMode: false,  
highWaterMark: 16384,  
buffer: BufferList { head: null, tail: null, length: 0 },  
length: 0,  
pipes: ,  
flowing: true,  
ended: false,  
endEmitted: false,  
reading: true,  
sync: false,  
needReadable: true,  
emittedReadable: false,  
readableListening: false,  
resumeScheduled: false,  
errorEmitted: false,  
emitClose: false,  
autoDestroy: false,  
destroyed: false,  
defaultEncoding: ‘utf8’,  
awaitDrainWriters: null,  
multiAwaitDrain: false,  
readingMore: false,  
decoder: null,  
encoding: null,  
[Symbol(kPaused)]: false  
},  
readable: true,  
\_events: [Object: null prototype] {  
end: [Array],  
timeout: [Function: socketOnTimeout],  
data: [Function: bound socketOnData],  
error: [Function: socketOnError],  
close: [Array],  
drain: [Function: bound socketOnDrain],  
resume: [Function: onSocketResume],  
pause: [Function: onSocketPause]  
},  
\_eventsCount: 8,  
\_maxListeners: undefined,  
\_writableState: WritableState {  
objectMode: false,  
highWaterMark: 16384,  
finalCalled: false,  
needDrain: false,  
ending: false,  
ended: false,  
finished: false,  
destroyed: false,  
decodeStrings: false,  
defaultEncoding: ‘utf8’,  
length: 0,  
writing: false,  
corked: 0,  
sync: true,  
bufferProcessing: false,  
onwrite: [Function: bound onwrite],  
writecb: null,  
writelen: 0,  
afterWriteTickInfo: null,  
bufferedRequest: null,  
lastBufferedRequest: null,  
pendingcb: 0,  
prefinished: false,  
errorEmitted: false,  
emitClose: false,  
autoDestroy: false,  
errored: false,  
bufferedRequestCount: 0,  
corkedRequestsFree: [Object]  
},  
writable: true,  
allowHalfOpen: true,  
\_sockname: null,  
\_pendingData: null,  
\_pendingEncoding: ‘’,  
server: Server {  
maxHeaderSize: undefined,  
insecureHTTPParser: undefined,  
\_events: [Object: null prototype],  
\_eventsCount: 2,  
\_maxListeners: undefined,  
\_connections: 1,  
\_handle: [TCP],  
\_usingWorkers: false,  
\_workers: ,  
\_unref: false,  
allowHalfOpen: true,  
pauseOnConnect: false,  
httpAllowHalfOpen: false,  
timeout: 0,  
keepAliveTimeout: 5000,  
maxHeadersCount: null,  
headersTimeout: 60000,  
\_connectionKey: ‘6::::4000’,  
[Symbol(IncomingMessage)]: [Function: IncomingMessage],  
[Symbol(ServerResponse)]: [Function: ServerResponse],  
[Symbol(kCapture)]: false,  
[Symbol(asyncId)]: 5  
},  
\_server: Server {  
maxHeaderSize: undefined,  
insecureHTTPParser: undefined,  
\_events: [Object: null prototype],  
\_eventsCount: 2,  
\_maxListeners: undefined,  
\_connections: 1,  
\_handle: [TCP],  
\_usingWorkers: false,  
\_workers: ,  
\_unref: false,  
allowHalfOpen: true,  
pauseOnConnect: false,  
httpAllowHalfOpen: false,  
timeout: 0,  
keepAliveTimeout: 5000,  
maxHeadersCount: null,  
headersTimeout: 60000,  
\_connectionKey: ‘6::::4000’,  
[Symbol(IncomingMessage)]: [Function: IncomingMessage],  
[Symbol(ServerResponse)]: [Function: ServerResponse],  
[Symbol(kCapture)]: false,  
[Symbol(asyncId)]: 5  
},  
parser: HTTPParser {  
‘0’: [Function: parserOnHeaders],  
‘1’: [Function: parserOnHeadersComplete],  
‘2’: [Function: parserOnBody],  
‘3’: [Function: parserOnMessageComplete],  
‘4’: [Function: bound onParserExecute],  
\_headers: ,  
\_url: ‘’,  
socket: [Circular \*1],  
incoming: [Circular _2],  
outgoing: null,  
maxHeaderPairs: 2000,  
\_consumed: true,  
onIncoming: [Function: bound parserOnIncoming],  
parsingHeadersStart: 0  
},  
on: [Function: socketListenerWrap],  
addListener: [Function: socketListenerWrap],  
prependListener: [Function: socketListenerWrap],  
\_paused: false,  
\_httpMessage: ServerResponse {  
\_events: [Object: null prototype],  
\_eventsCount: 1,  
\_maxListeners: undefined,  
outputData: [],  
outputSize: 0,  
writable: true,  
\_last: false,  
chunkedEncoding: false,  
shouldKeepAlive: true,  
useChunkedEncodingByDefault: true,  
sendDate: true,  
\_removedConnection: false,  
\_removedContLen: false,  
\_removedTE: false,  
\_contentLength: null,  
\_hasBody: true,  
\_trailer: ‘’,  
finished: false,  
\_headerSent: false,  
socket: [Circular 1],  
\_header: null,  
\_onPendingData: [Function: bound updateOutgoingData],  
\_sent100: false,  
\_expect\_continue: false,  
req: [Circular 2],  
locals: [Object: null prototype] {},  
[Symbol(kCapture)]: false,  
[Symbol(kNeedDrain)]: false,  
[Symbol(corked)]: 0,  
[Symbol(kOutHeaders)]: [Object: null prototype]  
},  
[Symbol(asyncId)]: 9,  
[Symbol(kHandle)]: TCP {  
reading: true,  
onconnection: null,  
\_consumed: true,  
[Symbol(owner)]: [Circular 1]  
},  
[Symbol(kSetNoDelay)]: false,  
[Symbol(lastWriteQueueSize)]: 0,  
[Symbol(timeout)]: null,  
[Symbol(kBuffer)]: null,  
[Symbol(kBufferCb)]: null,  
[Symbol(kBufferGen)]: null,  
[Symbol(kCapture)]: false,  
[Symbol(kBytesRead)]: 0,  
[Symbol(kBytesWritten)]: 0  
},  
httpVersionMajor: 1,  
httpVersionMinor: 1,  
httpVersion: ‘1.1’,  
complete: false,  
headers: {  
host: ‘[30f46877.ngrok.io](http://30f46877.ngrok.io)’,  
‘upgrade-insecure-requests’: ‘1’,  
‘user-agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_15\_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36’,  
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9’,  
‘accept-encoding’: ‘gzip, deflate’,  
‘accept-language’: ‘en-US,en;q=0.9’,  
‘x-forwarded-for’: ‘24.136.51.226’  
},  
rawHeaders: [  
‘Host’,  
‘[30f46877.ngrok.io](http://30f46877.ngrok.io)’,  
‘Upgrade-Insecure-Requests’,  
‘1’,  
‘User-Agent’,  
‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_15\_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36’,  
‘Accept’,  
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/_;q=0.8,application/signed-exchange;v=b3;q=0.9’,  
‘Accept-Encoding’,  
‘gzip, deflate’,  
‘Accept-Language’,  
‘en-US,en;q=0.9’,  
‘X-Forwarded-For’,  
‘24.136.51.226’  
],  
trailers: {},  
rawTrailers: ,  
aborted: false,  
upgrade: false,  
url: ‘/?code=HB…SA’, // elided for OpSec  
method: ‘GET’,  
statusCode: null,  
statusMessage: null,  
client: \<ref \*1\> Socket {  
connecting: false,  
\_hadError: false,  
\_parent: null,  
\_host: null,  
\_readableState: ReadableState {  
objectMode: false,  
highWaterMark: 16384,  
buffer: BufferList { head: null, tail: null, length: 0 },  
length: 0,  
pipes: ,  
flowing: true,  
ended: false,  
endEmitted: false,  
reading: true,  
sync: false,  
needReadable: true,  
emittedReadable: false,  
readableListening: false,  
resumeScheduled: false,  
errorEmitted: false,  
emitClose: false,  
autoDestroy: false,  
destroyed: false,  
defaultEncoding: ‘utf8’,  
awaitDrainWriters: null,  
multiAwaitDrain: false,  
readingMore: false,  
decoder: null,  
encoding: null,  
[Symbol(kPaused)]: false  
},  
readable: true,  
\_events: [Object: null prototype] {  
end: [Array],  
timeout: [Function: socketOnTimeout],  
data: [Function: bound socketOnData],  
error: [Function: socketOnError],  
close: [Array],  
drain: [Function: bound socketOnDrain],  
resume: [Function: onSocketResume],  
pause: [Function: onSocketPause]  
},  
\_eventsCount: 8,  
\_maxListeners: undefined,  
\_writableState: WritableState {  
objectMode: false,  
highWaterMark: 16384,  
finalCalled: false,  
needDrain: false,  
ending: false,  
ended: false,  
finished: false,  
destroyed: false,  
decodeStrings: false,  
defaultEncoding: ‘utf8’,  
length: 0,  
writing: false,  
corked: 0,  
sync: true,  
bufferProcessing: false,  
onwrite: [Function: bound onwrite],  
writecb: null,  
writelen: 0,  
afterWriteTickInfo: null,  
bufferedRequest: null,  
lastBufferedRequest: null,  
pendingcb: 0,  
prefinished: false,  
errorEmitted: false,  
emitClose: false,  
autoDestroy: false,  
errored: false,  
bufferedRequestCount: 0,  
corkedRequestsFree: [Object]  
},  
writable: true,  
allowHalfOpen: true,  
\_sockname: null,  
\_pendingData: null,  
\_pendingEncoding: ‘’,  
server: Server {  
maxHeaderSize: undefined,  
insecureHTTPParser: undefined,  
\_events: [Object: null prototype],  
\_eventsCount: 2,  
\_maxListeners: undefined,  
\_connections: 1,  
\_handle: [TCP],  
\_usingWorkers: false,  
\_workers: ,  
\_unref: false,  
allowHalfOpen: true,  
pauseOnConnect: false,  
httpAllowHalfOpen: false,  
timeout: 0,  
keepAliveTimeout: 5000,  
maxHeadersCount: null,  
headersTimeout: 60000,  
\_connectionKey: ‘6::::4000’,  
[Symbol(IncomingMessage)]: [Function: IncomingMessage],  
[Symbol(ServerResponse)]: [Function: ServerResponse],  
[Symbol(kCapture)]: false,  
[Symbol(asyncId)]: 5  
},  
\_server: Server {  
maxHeaderSize: undefined,  
insecureHTTPParser: undefined,  
\_events: [Object: null prototype],  
\_eventsCount: 2,  
\_maxListeners: undefined,  
\_connections: 1,  
\_handle: [TCP],  
\_usingWorkers: false,  
\_workers: ,  
\_unref: false,  
allowHalfOpen: true,  
pauseOnConnect: false,  
httpAllowHalfOpen: false,  
timeout: 0,  
keepAliveTimeout: 5000,  
maxHeadersCount: null,  
headersTimeout: 60000,  
\_connectionKey: ‘6::::4000’,  
[Symbol(IncomingMessage)]: [Function: IncomingMessage],  
[Symbol(ServerResponse)]: [Function: ServerResponse],  
[Symbol(kCapture)]: false,  
[Symbol(asyncId)]: 5  
},  
parser: HTTPParser {  
‘0’: [Function: parserOnHeaders],  
‘1’: [Function: parserOnHeadersComplete],  
‘2’: [Function: parserOnBody],  
‘3’: [Function: parserOnMessageComplete],  
‘4’: [Function: bound onParserExecute],  
\_headers: ,  
\_url: ‘’,  
socket: [Circular \*1],  
incoming: [Circular \*2],  
outgoing: null,  
maxHeaderPairs: 2000,  
\_consumed: true,  
onIncoming: [Function: bound parserOnIncoming],  
parsingHeadersStart: 0  
},  
on: [Function: socketListenerWrap],  
addListener: [Function: socketListenerWrap],  
prependListener: [Function: socketListenerWrap],  
\_paused: false,  
\_httpMessage: ServerResponse {  
\_events: [Object: null prototype],  
\_eventsCount: 1,  
\_maxListeners: undefined,  
outputData: ,  
outputSize: 0,  
writable: true,  
\_last: false,  
chunkedEncoding: false,  
shouldKeepAlive: true,  
useChunkedEncodingByDefault: true,  
sendDate: true,  
\_removedConnection: false,  
\_removedContLen: false,  
\_removedTE: false,  
\_contentLength: null,  
\_hasBody: true,  
\_trailer: ‘’,  
finished: false,  
\_headerSent: false,  
socket: [Circular \*1],  
\_header: null,  
\_onPendingData: [Function: bound updateOutgoingData],  
\_sent100: false,  
\_expect\_continue: false,  
req: [Circular \*2],  
locals: [Object: null prototype] {},  
[Symbol(kCapture)]: false,  
[Symbol(kNeedDrain)]: false,  
[Symbol(corked)]: 0,  
[Symbol(kOutHeaders)]: [Object: null prototype]  
},  
[Symbol(asyncId)]: 9,  
[Symbol(kHandle)]: TCP {  
reading: true,  
onconnection: null,  
\_consumed: true,  
[Symbol(owner)]: [Circular \*1]  
},  
[Symbol(kSetNoDelay)]: false,  
[Symbol(lastWriteQueueSize)]: 0,  
[Symbol(timeout)]: null,  
[Symbol(kBuffer)]: null,  
[Symbol(kBufferCb)]: null,  
[Symbol(kBufferGen)]: null,  
[Symbol(kCapture)]: false,  
[Symbol(kBytesRead)]: 0,  
[Symbol(kBytesWritten)]: 0  
},  
\_consuming: false,  
\_dumped: false,  
next: [Function: next],  
baseUrl: ‘’,  
originalUrl: ‘/?code=HB…SA’, // elided for OpSec  
\_parsedUrl: Url {  
protocol: null,  
slashes: null,  
auth: null,  
host: null,  
port: null,  
hostname: null,  
hash: null,  
search: ‘?code=HB…SA’, // elided for OpSec  
query: ‘code=HB…SA’, // elided for OpSec  
pathname: ‘/’,  
path: ‘/?code=HB…SA’, // elided for OpSec  
href: ‘/?code=HB…SA’, // elided for OpSec  
\_raw: ‘/?code=HB…SA’ // elided for OpSec  
},  
params: {},  
query: { code: ‘HB…SA’ }, // elided for OpSec  
res: \<ref \*3\> ServerResponse {  
\_events: [Object: null prototype] { finish: [Function: bound resOnFinish] },  
\_eventsCount: 1,  
\_maxListeners: undefined,  
outputData: ,  
outputSize: 0,  
writable: true,  
\_last: false,  
chunkedEncoding: false,  
shouldKeepAlive: true,  
useChunkedEncodingByDefault: true,  
sendDate: true,  
\_removedConnection: false,  
\_removedContLen: false,  
\_removedTE: false,  
\_contentLength: null,  
\_hasBody: true,  
\_trailer: ‘’,  
finished: false,  
\_headerSent: false,  
socket: \<ref \*1\> Socket {  
connecting: false,  
\_hadError: false,  
\_parent: null,  
\_host: null,  
\_readableState: [ReadableState],  
readable: true,  
\_events: [Object: null prototype],  
\_eventsCount: 8,  
\_maxListeners: undefined,  
\_writableState: [WritableState],  
writable: true,  
allowHalfOpen: true,  
\_sockname: null,  
\_pendingData: null,  
\_pendingEncoding: ‘’,  
server: [Server],  
\_server: [Server],  
parser: [HTTPParser],  
on: [Function: socketListenerWrap],  
addListener: [Function: socketListenerWrap],  
prependListener: [Function: socketListenerWrap],  
\_paused: false,  
\_httpMessage: [Circular \*3],  
[Symbol(asyncId)]: 9,  
[Symbol(kHandle)]: [TCP],  
[Symbol(kSetNoDelay)]: false,  
[Symbol(lastWriteQueueSize)]: 0,  
[Symbol(timeout)]: null,  
[Symbol(kBuffer)]: null,  
[Symbol(kBufferCb)]: null,  
[Symbol(kBufferGen)]: null,  
[Symbol(kCapture)]: false,  
[Symbol(kBytesRead)]: 0,  
[Symbol(kBytesWritten)]: 0  
},  
\_header: null,  
\_onPendingData: [Function: bound updateOutgoingData],  
\_sent100: false,  
\_expect\_continue: false,  
req: [Circular \*2],  
locals: [Object: null prototype] {},  
[Symbol(kCapture)]: false,  
[Symbol(kNeedDrain)]: false,  
[Symbol(corked)]: 0,  
[Symbol(kOutHeaders)]: [Object: null prototype] { ‘x-powered-by’: [Array] }  
},  
route: Route { path: ‘/’, stack: [[Layer] ], methods: { get: true } },  
[Symbol(kCapture)]: false  
}

---

<div class="post-metadata">

**Author:** ![jnw](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jnw/32/5402_2.png) [@jnw](https://devforum.zoom.us/u/jnw)\
**Post date:** [April 8, 2020, 1:00pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/4 "2020-04-08T13:00:35Z")

</div>

BTW, the URL **[30f46877.ngrok.io](http://30f46877.ngrok.io/)** is no longer active.  
I’ve shut down that forward.

---

<div class="post-metadata">

**Author:** ![jnw](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jnw/32/5402_2.png) [@jnw](https://devforum.zoom.us/u/jnw)\
**Post date:** [April 8, 2020, 5:29pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/5 "2020-04-08T17:29:21Z")

</div>

Found this error was a result of type in .env file.  
Thanks.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 8, 2020, 8:45pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/6 "2020-04-08T20:45:01Z")

</div>

Happy to hear you figured out the issue! 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![frakman](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/frakman/32/5837_2.png) [@frakman](https://devforum.zoom.us/u/frakman)\
**Post date:** [April 11, 2020, 5:21pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/7 "2020-04-11T17:21:18Z")

</div>

In my case, I didn’t have a typo but I didn’t add the “Redirect URL for OAuth” to the whitelist URL in the App Credentials page

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/0/091e29e8d1d933e39a4fab55be00d70c4faead05.png)

---

<div class="post-metadata">

**Author:** ![frakman](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/frakman/32/5837_2.png) [@frakman](https://devforum.zoom.us/u/frakman)\
**Post date:** [April 11, 2020, 5:38pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/8 "2020-04-11T17:38:37Z")

</div>

@tommy  
I tried using my access token in the [zoom api test page](https://marketplace.zoom.us/docs/api-reference/zoom-api/users/userpassword) to change my password (I am a single user account)

However, when I tried to send the PUT message, I got this error:

```
{
  "code": 1117,
  "message": "Can not update Admin's password"
}

```

Can you please explain why this happening? How is this API supposed to work if I can’t change my password?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 13, 2020, 8:04pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/9 "2020-04-13T20:04:31Z")

</div>

Hey @frakman,

What are you passing in for the {userID} param?

Also, are you using a user or account level OAuth app?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![frakman](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/frakman/32/5837_2.png) [@frakman](https://devforum.zoom.us/u/frakman)\
**Post date:** [April 13, 2020, 8:51pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/10 "2020-04-13T20:51:14Z")

</div>

Thank you for writing back @tommy.

I am using my email as the {userID}  
I am using the account level app.  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/8/87567976572e58b53105b85e63fff63c6ec61c19.png)

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 14, 2020, 8:38pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/11 "2020-04-14T20:38:34Z")

</div>

Hey @frakman,

Can you please private message me your email and request body so I can investigate further?

Also due note the enhanced password rules settings:

> **[Advanced security settings](https://support.zoom.us/hc/en-us/articles/360034675592-Advanced-security-settings)**
>
> Overview
> The Security section allows owners and admins to setup certain authentication and settings for users on the account. These options include password restrictions, restricting sign-in method...

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![georgiareporting](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/georgiareporting/32/6880_2.png) [@georgiareporting](https://devforum.zoom.us/u/georgiareporting)\
**Post date:** [April 26, 2020, 1:40am UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/12 "2020-04-26T01:40:33Z")

</div>

I am getting the same error. There is no typo in my .env file and I have my url redirect in both spots.

SyntaxError: Unexpected token u in JSON at position 0  
at JSON.parse ()  
at Request.\_callback (C:\Users\GalloPad\zoom-oauth-sample-app\index.js:29:25)  
at self.callback (C:\Users\GalloPad\zoom-oauth-sample-app\node\_modules\request\request.js:185:22)  
at Request.emit (events.js:210:5)  
at Auth.onRequest (C:\Users\GalloPad\zoom-oauth-sample-app\node\_modules\request\lib\auth.js:132:18)  
at Request.auth (C:\Users\GalloPad\zoom-oauth-sample-app\node\_modules\request\request.js:1341:14)  
at C:\Users\GalloPad\zoom-oauth-sample-app\index.js:82:12  
at Layer.handle [as handle\_request] (C:\Users\GalloPad\zoom-oauth-sample-app\node\_modules\express\lib\router\layer.js:95:5)  
at next (C:\Users\GalloPad\zoom-oauth-sample-app\node\_modules\express\lib\router\route.js:137:13)  
at Route.dispatch (C:\Users\GalloPad\zoom-oauth-sample-app\node\_modules\express\lib\router\route.js:112:3)

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 28, 2020, 10:32pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/13 "2020-04-28T22:32:59Z")

</div>

Hey @georgiareporting,

Can you console.log the body on this line:

> <https://github.com/zoom/zoom-oauth-sample-app/blob/master/index.js#L27>

Let me know what is returned so I can help debug.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![georgiareporting](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/georgiareporting/32/6880_2.png) [@georgiareporting](https://devforum.zoom.us/u/georgiareporting)\
**Post date:** [April 29, 2020, 9:01pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/14 "2020-04-29T21:01:32Z")

</div>

This is my first time doing this. I ‘believe’ I’m doing it correctly. My ngrok forwarding is the same as what’s in my .env file and on redirect.

This error code runs when I console.log body.

{“reason”:“Invalid request : Redirect URI mismatch.”,“error”:“invalid\_request”}  
access\_token: undefined  
refresh\_token: undefined

---

<div class="post-metadata">

**Author:** ![georgiareporting](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/georgiareporting/32/6880_2.png) [@georgiareporting](https://devforum.zoom.us/u/georgiareporting)\
**Post date:** [April 29, 2020, 9:42pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/15 "2020-04-29T21:42:19Z")

</div>

Now it is working for some reason. It didn’t work the first 50 times and it started to work after I posted the last error. I have no idea. I didn’t change anything.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 4, 2020, 10:28pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/16 "2020-05-04T22:28:40Z")

</div>

Hey @georgiareporting,

Glad you got it working! The redirect\_URI was probably not set in your App Marketplace Settings or in the .env file.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![anagaraju](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/anagaraju/32/11882_2.png) [@anagaraju](https://devforum.zoom.us/u/anagaraju)\
**Post date:** [July 14, 2020, 3:15pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/17 "2020-07-14T15:15:22Z")

</div>

Hello @tommy,

I’ve been seeing the same issue.  
Tried logging the body as you’d requested in.a response earlier. and this is what I see

`console.log(`body = ${body}, error= ${error}, response = ${response}`);`

```
body = undefined, error= Error: no auth mechanism defined, response = undefined
SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Request.request.post [as _callback] (/Users/anagaraju/code/zoom-oauth-app/zoom-oauth-sample-app/index.js:30:25)
    at self.callback (/Users/anagaraju/code/zoom-oauth-app/zoom-oauth-sample-app/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Auth.onRequest (/Users/anagaraju/code/zoom-oauth-app/zoom-oauth-sample-app/node_modules/request/lib/auth.js:132:18)
    at Request.auth (/Users/anagaraju/code/zoom-oauth-app/zoom-oauth-sample-app/node_modules/request/request.js:1341:14)
    at app.get (/Users/anagaraju/code/zoom-oauth-app/zoom-oauth-sample-app/index.js:83:12)
    at Layer.handle [as handle_request] (/Users/anagaraju/code/zoom-oauth-app/zoom-oauth-sample-app/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/anagaraju/code/zoom-oauth-app/zoom-oauth-sample-app/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/anagaraju/code/zoom-oauth-app/zoom-oauth-sample-app/node_modules/express/lib/router/route.js:112:3)

```

Repeated retries don’t seem to fix the problem.

Not sure why I see “No auth mechanism defined” as the error, because I choose “OAuth” as the auth mechanism on the first step

 ![Screen Shot 2020-07-14 at 11.23.47 AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/4/42132479529e2fef926262597fd86ad6e737e0cb.png)

Also ensured file is named .env, the way it was suggested here

> [@Automatically schedule meeting to non-organizational users with ID and Password](https://devforum.zoom.us/t/automatically-schedule-meeting-to-non-organizational-users-with-id-and-password/14019/6):
>
> Hey @k.chicagualar, Please try renaming the file to have a dot in front. .credenciales.env Also make sure you are referencing process.credenciales.env and not just process.env Thanks, Tommy

but to no avail

Thanks

---

<div class="post-metadata">

**Author:** ![anagaraju](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/anagaraju/32/11882_2.png) [@anagaraju](https://devforum.zoom.us/u/anagaraju)\
**Post date:** [July 14, 2020, 6:57pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/18 "2020-07-14T18:57:48Z")

</div>

Fixed it. Error on my end. Apologies 🙂

my .env file was in the wrong folder hierarchy.  
After moving it to the root directory of the zoom oauth app, I don’t see the error anymore and the response is what was expected

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 16, 2020, 9:34pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/19 "2020-07-16T21:34:14Z")

</div>

Hey @anagaraju,

Happy to hear you got it sorted out! 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 10:44pm UTC](https://devforum.zoom.us/t/zoom-oauth-sample-app-unexpected-token-u-in-json-at-position-0/11984/20 "2020-08-21T22:44:31Z")

</div>

Closed on August 21, 2020, 10:44pm UTC


