I watched the 5th video in the API Authentication playlist. It’s heavy with Mongoose, of course. Everyone fucking uses mongoose. Which is fine, except it’s become a crutch upon which those who rest on pass to those struggling to learn. Ah well, this will be trouble for another time, as I’m not quite at the point where I can begin querying my database. However, MongoDB is installed and ready to go, and my app is connected to it upon startup. None of it’s relevant at the moment, though.
I built a scratch site today. I created a separate block on my serve to be able to access this temporary site, and once again followed along with the discord.js guide to create a super basic server and hand deliver the data I needed to send to Discord in order to exchange the access code for a token. Everything worked well, up to the point that I needed to plug into the database and establish a session for the user. What I realized is that I understand the process well enough, I just don’t know how to adapt the scratch code to my main project, using Express.js. What am I missing here?
Taking what I learned, I returned to my main app and refactored some of the code along the auth route to see if I could come up with the same results as the scratch site. The answer is a definitive no. However, I did manage to get beyond the point of where the page hangs. I think with a little bit more practice, I can get it to work. From there, I want to figure out how to access the user’s Discord ID and use that as the user’s Object ID (_id) in the database. One step at a time, though.
Comments? Follow me on twitter and drop me a line in response to this tweet:
Day 013: I set up a scratch site today to test a very basic version of the auth flow in a discord.js guide, w/out @UseExpressJS. Worked like a charm. So now what? How do I adapt what works to the system I’m using?https://t.co/Mpyi0Y8IOS#nonsensemod365 #thatCodingLife pic.twitter.com/pvNcPPpWBt— Joshua Alexander (@nonsensecodes) April 30, 2020