Today I've finally managed to introduce google account login in my app, making it more dynamic and avoiding hard coded tokens. As of today, the user can log into his account, possibly rename the root folder and sync his hard coded folder into Google Drive. Routes, controller and middewares were added alongside EJS for handling templates. I thought about using React but it would turn the app more complex and I think it'll be good practice for me.
There were a lot of challenges today. I've had a hard time figuring out where to start the user login feature. The Google API package does a lot but I still needed to store that in a table since I don't think that storing it in a file will make much difference. Then I needed to create the routes and controllers. Those were simple but I need to get the rust of first. The thing was that I didn't know how to integrate the server callbacks into my class functions. I needed data that was in a request and the next one since I need the tokens and a name for the database. The workaround was creating the folder first with a default name and renaming it afterwards. And I think I'll stick with that since I plan on adding folder selection alongside folder renaming. I had to add two middlewares to stop authenticated and not authenticated users from entering certain endpoints and in the end they look very similar. The tougher challenge was probably stop thinking if I'm doing it right and start doing it anyways because i'd just be stuck there otherwise.
It's really weird how can one be unproductive when the feeling of making progress feels so good. Maybe it's because programming can be really stressing when it doesn't works but I should know by now that I really need to stop procrastination and get more of theses moments on my life. Something to be happy for.
There are lots of improvements I want to make but the first one that comes in my is hashing the password in an attempt to make it more secure. I'll still have to keep the secret to decode the password in local storage but I'll make it a random string. I don't have the slightest idea on how to make it impossible for the owner of the code to just drop a line there and send it to his server so I think that's the best I can do for now. Make the system create a random string and save it locally in order the get the password back. One thing very important that I just remembered when I was writing the lines above is that my program tracks hard coded folders and now I need to be able to pick folders from the hard drive on my HTML pages. I'm sure there is a browser API for that and that will be something nice to add. I don't think those will take much time so I'm confident that I'll be able to add some other features not so important.
Lots of room to improvement but little by little this app is turning into something I'm really proud of.