WhoAmI1000 / discord-oauth2-example

Example of a Discord OAuth2 Login System
https://circlertech.com/working-with-discord-oauth2
MIT License
27 stars 12 forks source link

weird error (no /user) #5

Closed LeoonThePaster closed 2 years ago

LeoonThePaster commented 2 years ago

hey, i get that output image

please help me asap.

WhoAmI1000 commented 2 years ago

Hello oneBroke,

Is this being hosted locally or on a server? Either way, was there anything logged in the server console?

LeoonThePaster commented 2 years ago

hey, its hosted on an Server. and no nothing has printed in the console

LeoonThePaster commented 2 years ago

image

WhoAmI1000 commented 2 years ago

In oauth.js, try adding a console.log(response.data); between lines 50 and 51. Try running the app again and take a look at what the console logs (does it display the correct discord info, or give an error/html page?). Could you also verify that express.js and node-fetch are up-to-date (or just directly update them with npm up express node-fetch)?

LeoonThePaster commented 2 years ago

hey, i tried that console.log but nothing logged to console... i needed to downgrade node-fetch because in newest version you cant use require().

LeoonThePaster commented 2 years ago

image

WhoAmI1000 commented 2 years ago

You can load the latest version of node-fetch asynchronously by replacing line 7 (loading node-fetch) with const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));. See if that works; I’m currently not able to do much tinkering on my own device, but I should be able to tomorrow.

LeoonThePaster commented 2 years ago

okay let me try

LeoonThePaster commented 2 years ago

soooo... nothing changed after using that. ima try some other stuff rn if you have an fix pls send it to me fast. good night if not heh

WhoAmI1000 commented 2 years ago

I’ll look into it and send you a fix as soon as I can. Good night to you, I guess.

WhoAmI1000 commented 2 years ago

Oh, real quick: Did this show before or after you logged in with discord and were redirected back?

WhoAmI1000 commented 2 years ago

Hey oneBroke, could you confirm whether this appeared before or after you logged in on the discord portal and redirected back to the page?

WhoAmI1000 commented 2 years ago

Hello oneBroke,

I will close this issue to to inactivity. This looks to be like an error with the /user POST API. Please reopen this if this issue persists.