Electron : how to manage user auth in main and renderer process?

205 Views Asked by At

I am building an Electron App with this user flow: 1- User logs in 2- Enters local db credentials 3- App fetch local db every X minutes 4- App sends data to somewhere else logged in as the user

Since I use Supabase and want to use their client SDK as much as possible : I authenticate the user twice : in the renderer process and also in the main process. On login, I send an IPC message to the main process with the credentials and request a login again. This way I can use supabaseClient in my main and renderer process.

At first I thought it was a good idea but I read that http requests should be done on the renderer process for network security purpose (eg in a company network). Furthermore, the requests are split all around the code base and it is a pain to find anything as there is no logical ordering.

In short, how should I manage user auth? How should the app be designed (what process does what)?

Any additional insight is also appreciated!

0

There are 0 best solutions below