How can I manage sessions in my Chrome Extension?

Viewed 174

I have made a React-based Chrome extension for language learners. I would like to add features that will require a backend server and unique user sessions which I am creating.

The server will be a ruby on rails application. Normal session management with rails apps involves the browser sending back the session cookie when requests are made to a specific domain.

However, my client "app" is now an extension that is not accessing my site directly. I'm unsure of the specifics of how to maintain sessions that correspond to my backend server through the extension.

This is what I think so far:

  • Client signs in via a form on the extension
  • The backend responds with a session key of some kind
  • The extension saves the key in localstorage or maybe a cookie?
  • On subsequent page loads, the extension load script re-validates the session cookie in some way by sending it back to the server?

I will likely use Devise for log-in on the back-end server, but I'm not sure how to integrate the flow I need with that tool that usually used for standard client-server interactions.

0 Answers
Related