Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struggling on setup Evercookie like dummy example #12

Open
Frige1 opened this issue Sep 20, 2018 · 3 comments
Open

Struggling on setup Evercookie like dummy example #12

Frige1 opened this issue Sep 20, 2018 · 3 comments

Comments

@Frige1
Copy link

Frige1 commented Sep 20, 2018

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

@daddyz
Copy link
Owner

daddyz commented Oct 15, 2018

Are you using rails5 branch?

@Frige1
Copy link
Author

Frige1 commented Oct 15, 2018

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

@daddyz
Copy link
Owner

daddyz commented Oct 16, 2018

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants