leo / electron-next

Build Electron apps using Next.js
https://github.com/leo/site/blob/beef3a7dc1dfd435a9d8377e3b1b59761ccb7fc7/pages/2017/electron-next.js
MIT License
548 stars 41 forks source link

Authentication Tokens in electron-next #11

Closed alexpareto closed 6 years ago

alexpareto commented 6 years ago

Generally in next.js it's best practice to store authentication tokens in cookies so that the token can be read in both the server and client for SSR (e.g. in getInitialProps). Since electron doesn't support cookies in the renderer process - what would be the best way to keep track of auth tokens (and persist them between sessions)?

In now-desktop, it seems like a config in the main process is used and then electron remote is used to communicate with the config. Is there a more simple best practice than this?

leo commented 6 years ago

Two things:

😊