I am facing some issues while sharing the cookie between wordpress and reactjs application.
The following are the example IPs for frontend and wordpress:
- Frontend server IP address : https://165.23.115.114
- WordPress server IP address: http://179.68.87.7
If I login from the reactjs application or wordpress and vice-versa then wordpress logged in cookie will be shared with reactjs application which we are not getting.
I am using the GRAPHQL and GRAPHQL cors masters plugin at wordpress end. I am integrating the wordpress login at reactjs application.
The following is the CORS plugin for reference:
https://github.com/funkhaus/wp-graphql-cors
But, Cookie is shared at my local server perfectly but not at live server.
For local using the following:
- Reactjs – http://localhost:3000
- WordPress: http://localhost
I have added the SSL on both the IPs.
And I also find it there might be some CORS issue.
This is my CORS setting for GRAPHQL its for local but same i did for live only changed the IPs
I want to make cookie sharing or set cookie at live server too.
2
Answers
Thanks for your response.. Now, I am trying with the subdomain , I have created the subdomain
My main domain is like : https://testweb.io Subdomain is : https://testing.testweb.io
I have added the subdomain at GRPAHQL plugin Settings at wordpress but still cookie is not shared.
Please check this, I added the subdomain at CORS plugin Here I added the cookie domain
Both are not working ,please suggest how do i share the cookie with subdomain??
You’re trying to share cookies between origins. You Can’t Do Thatâ„¢. You need to find some other way to share state.
An origin is a server. Examples of origins include
https://stackoverflow.com/
,http://example.com/
,http://localhost/
, and the ones you mentioned.The documentation for cookies says