alagaesia
alagaesia

Reputation: 1629

Set-Cookie directive in Electron.js not working

I have a problem. In my Electron app I have a login form. On form submit I fetch a Rails Devise based auth server, which completes and responds with Set-cookie direction < app_name>-main_session

In my electron main process I have the response with working cookies, but they are not set and I can't set them manually (for security reasons).

I'd like to use https://github.com/electron/electron/blob/master/docs/api/cookies.md to set my session cookie. But I can't.

Has anyone figured out how to do this?

Thanks in advance

Upvotes: 1

Views: 995

Answers (1)

Daniel Westendorf
Daniel Westendorf

Reputation: 3465

Obviously, you're running into problems with security protocols in place to keep session information private. You'll need to change your methods one way or the other.

You'll need to choose one of two approaches for this:

  • Treat your rails app as a pure API, in which case you'd use something link a JSON Web Token or custom API key sent with each request. This works best if you're generating views from electron itself.
  • Execute all your actions within the context of a Webview, which goes through the normal devise authentication flow. This works well if you're basically just using electron as a shell around server render views.

Upvotes: 1

Related Questions