why is laravel login me out when using sentry? - laravel

I'm new to Laravel and I am working on an application. I am using sentry to handle users and the login system. But even though my session expiration is set very high, I keep being logged out very frequently, at random times. Is that a laravel problem or maybe an incompatibility with Sentry 2? Any ideas?

You didn't mentioned, but I have to ask, do you have more than one laravel application running on the same server? I've noticed that laravel tends to put the cookie session on the root of the server and if you have two Laravel-based applications running on it with the same location / name (by default, it is called laravel_session), they will overwrite each other.
If that is the case, try going into AppName / app / application / config / session.php and either change the path or the cookie component of the driver. I had trouble changing the path of the session, but if you change the name to, let's say, appName_session instead of laravel_Session it should solve your problem.
Hopefully that is what you meant and that it helps. Good luck.

Related

Laravel SPA (laravel + vuejs + sanctum) deployed in subdomain returns wrong api

I have this problem since several days.
I'm developing a Vuejs/laravel app, using Sanctum as an authenticator. where laravel mainly have the api gestion role, and I've started to deploying it. On Local, everything looks fine, api and auth are working.
On deploy, since my app is binded to be in a subdomain (laravelapp.maindomain with folder path of domain/laravelapp), when i try to access any page (vue-router) instead of domain/laravelapp/login i get domain/login, even if the page itself is looking fine.
If i try to reload the redirected page (domain/page) i have a 404. Also, since every API is pointing to domain/api/link instead of domain/laravelapp/api/link, everything is broken starting with auth.
I've tried modifying .env file, RouteServiceProvider, .htaccess(but i have no knowledge about that).
I also tried to set the subdomain Document Root to domain/laravelapp (it's the first thing i've done), but not only it dosn't work, if I try to print on screen subdomain's root, it returns domain. It's becoming a real issue right now, thank you for any help.
EDIT: I've discovered something. in the main domain there is a Joomla application. The api route contains the Joomla redirect (like, there is a plugin oh the site that changes language automatically, appending /en /it /de given the chosen language). So, in my case, the api is domain/index.php/en/subdomain. I tried again being more specific with document root, with no results, and playing around with .htaccess, but with no success.

Issue with Laravel 5.2 and His non-persistent App SetLocale over http://

Can anyone point me in the right direction when trying to troubleshoot this web app (Dorothea Special School) I created a few years back using this link Laravel 5 And His F*cking non-persistent App SetLocale
If I can recall it was working perfectly when I 1st published the web app, but for a while now it doesn't seem to be working correctly... I think I did check the log file on the server and a couple more things to no avail. Do you think I need to run a composer cmd on the server?
You have 2 options: only allow https through redirecting http or disabling secure for cookies in your config.

Session is expired when working on two different projects at same time

I have two projects of sugarcrm installed on my local server, nothing wrong with that.
Now I start my first project i.e. sugarcrm in the browser, login with the credentials, and after that when I opened the second project i.e. demo_sugarcrm in the browser and login, my sugarcrm session is expired.
And same with the demo_sugarcrm also. Its session expired when I login to the sugarcrm
What is going on here, I have totally different database of both. they dont share anything except that both are on local sever.
I think adjusting unique_key is supposed to fix this, but as an alternative you could modify /etc/hosts such that 'sugarcrm' and 'demo_sugarcrm' hostnames both reference 127.0.0.1. Then you could visit http://sugarcrm and http://demo_sugarcrm. I'm sure any shared cookie mayhem would go away at that point since the browser would consider these to be distinct sites.
I believe that if you edit config.php and change the unique_key variable to be different between the two instances then you shouldn't get kicked out anymore.

PHP sessions or cookies not storing on server. PHP.ini misconfiguration

I am working on a simple SESSION/COOKIE login system for a website on a standard shared hosting account. The problem is that neither sessions or cookies are stored. My code is 100% correct but the server is misconfigured.
I have noticed that there was no folder in which to store sessions so I created one and added a local php.ini file. Sessions are stored in that folder properly but they don't work when I try to use them in my PHP website.
I have talked to support but they are very bad.
The server configuration is this: http://luttnerre.com/test.php
Thank you !
Have you checked the permissions on the specified directory? The php process needs to be able to write to it.
If cookies aren't being stored on client browsers then something is wrong with your code, these don't depend on the server session handling being configured correctly. If cookies aren't being stored, then sessions won't either so I'd look at the cookie problem first, then the session one.
Remember that cookies and session variables must be declared before any other output or you have to turn output buffering on. Check http://www.php.net/manual/en/function.ob-start.php
Even empty characters in a include before or after tags can lead to errors.
Also check your error_reporting level since some important debug messages could stay supressed. See http://php.net/manual/en/function.error-reporting.php

Access cakephp session (auth) from outside cakephp

I have a CakePHP website with its own login system using the Auth component. I would like to know if the following is possible:
A user has logged in and is navigating the website. At one point, he can click a link that opens an external php file. With external I mean that it could be in another folder of the same server, but outside the CakePHP app folders.
The "tricky" thing (for me) is to only show the contents of that php file if the user is logged in (to prevent someone without an account accessing those contents). I can't use Auth there because I'm "outside" Cake... I don't know if maybe using $_SESSION, but I don't know how...
Is this even possible? And yes, the php has to be outside the CakePHP app folder system.
Any ideas?
I'll add you also need to set session name to "CAKEPHP" using
session_name('CAKEPHP')
just before your external app session_start() otherwise you could not apply Kashif Khan suggested solution :)
Cheers,
Yes you can access the cakephp SESSION outside cakephp folder. try this session variable
$_SESSION['Auth']
if it exists then check for user here
$_SESSION['Auth']['User']
This is not working in Cakephp3. After calling
session_name("CAKEPHP");
session_start();
Application session is expiring.

Resources