heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
24k stars 5.55k forks source link

How can I sign into my back end inside of a Chrome extension? #5520

Closed benlieb closed 1 year ago

benlieb commented 2 years ago

I've written a Chrome browser extension that loads a react-driven UI into users' webpages. In order to customize their experience, I'd like to allow them to "log into the extension". Would something like this be possible?

I've used Devise for many years and I understand it to rely on cookies that the browser sends when communicating to other servers.

In this case however, I'm not sure if this standard setup would work, since the front end URLs could be any url and the cookies would be associated with that?

Someone please point me in the right direction.

carlosantoniodasilva commented 1 year ago

You may be able to use something like HTTP Auth, but perhaps what you're looking for is more like a token based solution like described in the linked wiki(s) there, and store that token somewhere within the extension safe storage systems for each subsequent API call to the app. I haven't built any Chrome extension though so I don't know the details of it, but the authentication side from the app's perspective shouldn't be much different than an API based auth.

For more help I'd recommend you try Stack Overflow. Thanks!