Cannot read id after login

Hi, I recently started building a simple node js application to validate a patrons pledge and then initiate a download. Everything was going fairly smoothly and I uploaded a copy of the app to my host to test.

When I login on the same account that the api key was created with, everything works as intended. But when I login using a test account, I am getting the following error:
TypeError: Cannot read property ‘id’ of undefined
at Request._callback (/conftron/node_modules/passport-patreon/lib/passport-patreon/oauth2.js:32:25)
at Request.self.callback (/conftron/node_modules/request/request.js:185:22)
at Request.emit (events.js:314:20)
at Request. (/conftron/node_modules/request/request.js:1154:10)
at Request.emit (events.js:314:20)
at IncomingMessage. (/conftron/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:420:28)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

After researching the patreon-passport node.js module that I am using, the error in question is line 32 of this file: https://github.com/mzmiric5/passport-patreon/blob/master/lib/passport-patreon/oauth2.js
which seems to be a fairly normal means of getting data from a json object.

What confuses me most, is that it works fine for the account that created the app key. Anyone got any idea what could be causing this? Have I done something dumb like not enable the app for other users or something?

Any help would be greatly appreciated!! <3

Thanks
~Dekita

Edit: After some further investigation, it seems I’m getting a 403 error when I try to login with my test account if I only have the scope ‘identity.memberships’ (which is the only one I need, and again, works fine for the creator account logging in) but if i include ‘identity’ and ‘identity[email]’ scopes then it also works as intended. Really not happy about having to ask for these scopes though as I really dont need it and I feel like it makes my app look as though its requesting unnessicary information about my patrons. Still seeking any help to improve this if possible.

which seems to be a fairly normal means of getting data from a json object.

You may end up getting actual html response from cloudflare. So its best to check for valid json object before checking for a json object property.

Really not happy about having to ask for these scopes though as I really dont need it and I feel like it makes my app look as though its requesting unnessicary information about my patrons. Still seeking any help to improve this if possible

Creator tokens automatically remove all scopes they need so you wont be having issues with scopes there.

However when requesting access via apiv2, scopes are not automatically granted, they have to be separately asked. This is for both fine granularization purposes and resource efficiency, but also it is for legal/privacy purposes. So you will need to ask those permissions explicitly by requesting those scopes.