evercookie icon indicating copy to clipboard operation
evercookie copied to clipboard

Struggling on setup Evercookie like dummy example

Open Frige1 opened this issue 7 years ago • 3 comments

Hey,

i have some problems to setup a simple evercookie site pretty similar to the example dummy App.

If i start the Sever on Localhost:3000 i get the Index site and if i try to get oder set a Cookie, it fails. For example if i try to set a Cookie and sumbit the form i have some error in the console. (500 Internal Server Error - for etag, cache, auth, png) Furthermore i can see, that the set.js file does not contains any information from <%= @data[:key] -%>', '<%= @data[:value] -%> and this leads to ec.set('', '')

Versions: rvm - 1.29.4 (set rails as default) gem - 2.7.7 rails - 5.2.1 bundler - 1.16.2

Frige1 avatar Sep 20 '18 16:09 Frige1

Are you using rails5 branch?

daddyz avatar Oct 15 '18 04:10 daddyz

I wrote down the versions which I use for my testing. So , yes I using rails 5.

Frige1 avatar Oct 15 '18 13:10 Frige1

@Frige1 I asked if gem was installed from rails5 git branch. Published version doesn't work on rails 5. Add this to your Gemfile

gem 'evercookie', github: 'daddyz/evercookie', branch: 'rails5'

My setup is the following. After successful signup page view has:

set_evercookie(:uid, current_user.id)

Registration form view has:

check_evercookie(:uid)

And controller action handling registration has:

ever_value = evercookie_get_value(:uid)

After signup I am setting signed up user ID. Since it's stored on client side on registration form I include helper that adds JS for fetching evercookie value and pass it to controller in order to save in session. And registration controller action checks session for value that was set in previous step. Hope it helps

daddyz avatar Oct 16 '18 06:10 daddyz