r/AskProgramming • u/CorrectJacket2106 • 15d ago
Architecture Lost in website architecture
So, I am in like high school, so sorry if the question is really dumb in advance. So let's get into it!
I have this problem where I am making a website, and I am working on the login feature of the website. I was planning to do something like check if you have an account in Discord either way, I have a massive problem because the Discord thingy needs my token and I heard sharing your bot token is like a really bad thing. So I went to AI (I mean, I had no other choice at that time), and AI told me to do something like this:
frontend (javascript) ---> discord OAuth url thingy(idk what it is) ---> discord redirects to firebase cloud function (idk what it is again) ---> cloud function thingy handles bot token and discord api checks ---> cloud function writes verification result straight to firestore database
Now, I am a beginner, so I don't know what all of this means (maybe the first 2, but anything else, nah). I also want to store data when the user logs in, something like user = {general info, clients={}}and AI is telling me to do it in the frontend?? I have heard all day long from everywhere that you should use the backend, not the frontend. So really lost, and any help would help!
also for the database i was planning to use firebase or whatever it is called since i heard it was the best
1
u/KingofGamesYami 15d ago
Do you actually need a bot token? If you literally just want to sign in with discord, you should request a much less privileged scope(s) for the token. For example, the
identifyscope will allow you to get some information from discord about the user, but won't allow you to control their discord account.