1

I currently develop a chrome extension with quite similar functionality like pocket (https://chrome.google.com/webstore/detail/save-to-pocket/niloccemoadcdkdjlinkgdfekeahmflj?hl=en).

I have a main site (let say it's called https://mypocketsite.com), where user can signup/login on this site.

My goal is : from my chrome extension, how do i get user session (who's currently logged in at my main site -> https://mypocketsite.com) ?

I've read the chrome developer extension documentation, but just got stuck on how to make it works. Any helpful advice would be greatly appreciated. thanks!

Harkedian
  • 21
  • 3
  • The question isn't really answerable with the info you provided. The solution depends on how the site stores the session. Your content script can read its cookies or localStorage directly. In case it's cookies there's also an alternative way: chrome.cookies API in the background script. – wOxxOm Feb 06 '20 at 04:39
  • thanks @wOxxOm. It means that on my main site I need to change the way it stores the session. I got the idea. – Harkedian Feb 06 '20 at 07:21

1 Answers1

0

Nowadays cookies are avoided for storing sessions as they have become old, instead using indexedDB is more common pratice( a good one ), so store session related info. in that. Then, to access IndexedDB use content scripts.

For more info on accessing IndexedDB check out here:https://stackoverflow.com/a/60002682/9131807

neelesh bisht
  • 640
  • 8
  • 13