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

Can't set cookie via API endpoint #1772

Closed
zauzaj opened this issue Jul 24, 2018 · 4 comments
Closed

Can't set cookie via API endpoint #1772

zauzaj opened this issue Jul 24, 2018 · 4 comments

Comments

@zauzaj
Copy link

zauzaj commented Jul 24, 2018

Hi,

I have to set secure & http_only cookie from BE for master domain - website.com where those cookies will be also used by subdomains - sub1.website.com, sub2.website.com etc ...

I've tried with cookies, headers['Set-Cookie] but nothing works as expected. Is there any other way to do it via GrapeAPI ?

Any help would be appreciate.

Thanks

@zauzaj
Copy link
Author

zauzaj commented Jul 25, 2018

@dblock Do you have any opinion here pls ?

@dblock
Copy link
Member

dblock commented Jul 25, 2018

Can you please define "nothing works as expected". What are you seeing in terms of set-cookie line(s) emitted from the API and what do you expect to see?

@zauzaj
Copy link
Author

zauzaj commented Jul 26, 2018

@dblock Hi, seems that it was kind of wrongly configured. I'm still not sure why, but as we're dealing with subdomains, FE app had to include withCredentials: true or cookies wont be included in request. That's weird but that's how it is.

Anyway it works as expected now.

I have another question here, is there any way to Rspec cookies which are set from Grape endpoint. I see in gem there is no specs, so maybe you have any hint or so ?

Best Regards,
Bojan

@dblock
Copy link
Member

dblock commented Jul 26, 2018

There're definitely specs for cookies, here. We could always use more, feel free to PR.

With RSpec, response.cookies should be working AFAIK.

I'll close this since the original issue was resolved. Please try to use the Grape mailing list for questions.

@dblock dblock closed this as completed Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants