I recently finished my voting app project but i'm not happy with my login system

I recently finished my voting app project but i'm not happy with my login system
0

#1

edit: Solved it.

I finished the voting app project but the login system i made i think is pretty bad. I implemented only github login using oauth 2. Oauth 2 requires a callback url where with passport all the user data is being sent to after they authorized my application. The problem is that if I want to use that data properly i would have to use a templating language as far as I know. I made the project with react, and I couldn’t find a way to template a file with it.

Everywhere I looked the method to log in a user was:
I redirect the user to github authentication => they authorize => github sends the data to a callback url => Passport dependency does it’s stuff to give me the user data => I use the user data in a templteing language to serve a file where the user is logged in.

Since with react I don’t know how to template if it’s even possible I did this:
I redirect the user to github authentication => they authorize => github sends the data to a callback url => Passport dependency does it’s stuff to give me the user data => I made a data base of users, if the user doesn’t exist yet make a new data document for him/her => redirect the user to a url where i make an api request to my own server to get the user data from the database => I save the data on the frontend in variables to log the user in.
(i know it’s bad )

So i wonder how is it possible to use oauth2 properly without templating languages.

Project: https://absolitudo.herokuapp.com/projects/voting-app
Backend: https://github.com/absolitudo/heroku-page/blob/master/backend/fullstackProjects/votingApp/votingApp.js
Frontend: https://github.com/absolitudo/heroku-page/tree/master/frontend/src/projects/fullstack/votingApp

(The rest of the site is not done yet, but you can access my previous projects)