Sharing Laravel Auth::check() not working on subpages - laravel-5

I am sharing the laravel session across subdomains. It is working on the main page but not on any inner pages.
Example:
sub1.example.com = Logged into laravel
sub2.example.com = Shows logged in on the home page but not inner pages.
I have my session domain set correctly but it's not working.
'domain' => '.example.com'
I cleared cookies in browser.
Update
After removing / from my app url it has been resloved.

Related

Not showing modal cookie policy on certain routes

I am using [statikbe/laravel-cookie-consent] package for cookie policy in my Laravel project and I don't want the modal to be shown on certain pages, so I must add the route to ignored_paths array in the config file. For a route as 'admin/users' every thing is fine but for a route as 'admin/user/{id}' it doesn't work. How can I fix it or how can say all the routes which start with '/admin' don't show the cookie policy?

Magento 2: My Headless Magento catalog with guest cart to redirect to magento vanila checkout page but need to know how to transfer session

Hi I have created a reactjs single page catalog using Rest API and we still have live magento 2.1 website running in vanilla mode.
Our live vanilla website support all required payment modes and therefore want my react web app to redirect checkout on live magento website.
I have successfully build the react app which can add products in cart and view cart using quoteID and Quote Mask ID. Now I need to know like vanila Magento can I set some session or cookies and then redirect user to live Magento website checkout page.
Now I have failed to understand how magento vanila frontend identifies guest user pulls exact cart items on their default cart page. what exactly are they storing in cookie or localstorage of the browser that they are able to map to the quote id in the backend.
If someone can direct me will be great. I have already looked into Quote table, Quote_items table and vistor table too but did not find any link to PHPSESSIONID. Now I doubt whether they even rely on it.
www.example.com is my live website
and webapp.example.com is my PWA/ReactJS based which consumes Magento's Web api.
public function __construct
(
\Magento\Framework\Session\SessionManager $sessionManager
)
{
$this->_session = $sessionManager;
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
$sessionID = $this->_session->getSessionId();
}
URL: https://www.example.com?SID=sessionid
Example: https://www.example.com?SID=v32hjtpgt8e12jorc0tksekkj6
Magento store sessionid at cookie and session data at server which location is define in env.php

Laravel 5 - weird sessions

in my application, after few requests, Laravel sessions randomly expired.
On my site, i had invalid links to images, i repaired them and everything works fine now.
What could be the problem? How could repairing links helped Laravel sessions from not being randomly deleted?
All your routes are inside middleware 'web' ? If you redirect to a route outside 'web' you loose sessions. Check that and return please.

Magento Shopping cart empty after adding product to cart and proceed to checkout

I do have problem while checkout out cart getting empty, strange thing is not for everyone and not always.
In few system it's working fine and most of the system shopping cart empty.i am using FPC a free full page cache module even disabling that no help.
I have tried following things with no luck.
1.Set the higher cookies value in session cookie management 1day,10day,100day,cookie domain set to blank and path set to (/ and
or blank)
Use HTTP Only to No
and in session validation setting everything set to NO (Validate REMOTE_ADDR,Validate HTTP_VIA,Validate HTTP_X_FORWARDED_FOR,Validate
HTTP_USER_AGENT,Use SID on Frontend)
When HTTP_USER_AGENT set to Yes, new error came the page has a redirect loop but clearing the cookies and cahe working but not the
solution.
When (Validate REMOTE_ADDR,Validate HTTP_VIA,Validate HTTP_X_FORWARDED_FOR,Use SID on Frontend) any of these set to Yes
page started redirecting to home page, not able to see product page.
But no luck
2.commented the code in Mage_Core_Model_Session_Abstract_Varien::start()
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()
/'domain' => $cookie->getConfigDomain(),
'secure' => $cookie->isSecure(),
'httponly' => $cookie->getHttponly()/
);
No Luck
3.Strange thing happened always i am getting two different cookie with same name as frontend with different domain values domain.com
and .domain.com with sometimes different value for chrome and firefox
one (domain.com). I am failing to understand who is setting this
cookie domain in magento when commented out the above code still has
the cookie domain and even when domain explicitly set to blank still
there is cookie domain. i manually searched those cookie values in
var/session folder and found those entries as well.
Does anyone have any further idea how to get rid of this.

laravel 4 url redirect cache

In my app, Home is the default Controller set.
I am having a Main controller which redirects to home page if a particular session variable is not set.
After Login validation, session is created for the user and redirects me to home page. On home page when I click on the link to main page "http://domain/main" it redirects the user to home page again.
when i type "http://domain/main/" in the url, it opens the right page. but "http://domain/main" is redirecting to "http://domain/home".
when i clear session files in storage and login "http://domain/main" works but after some time it redirects me to home page again.
I believe there is issue with laravel caching as in my code the redirection handling is perfect.
Sometimes browser caches the redirect 301 url. So in your code if you set session variable on some condition. and you redirect(301) to a page on set of a session variable than your browser caches that redirection.
So if at first session variable is not set, and your code redirects(301) to a different link. next time when you set variable on client interaction and your session variable is set, even than your browser will redirect you to the cached link. to avoid that you must pass redirect http code to the redirectto('location url','302') function in laravel.

Resources