# Laravel integration working locally but not in prod

**URL:** <https://community.auth0.com/t/laravel-integration-working-locally-but-not-in-prod/185707>\
**Category:** Dev to Dev Hub\
**Tags:** application, sso\
**Created:** [April 19, 2025, 9:25pm UTC](https://community.auth0.com/t/laravel-integration-working-locally-but-not-in-prod/185707 "2025-04-19T21:25:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![morris14](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/morris14/32/74383_2.png) [@morris14](https://community.auth0.com/u/morris14)\
**Post date:** [April 19, 2025, 9:25pm UTC](https://community.auth0.com/t/laravel-integration-working-locally-but-not-in-prod/185707/1 "2025-04-19T21:25:38Z")

</div>

Hi all! I’m trying to follow the basic Laravel integration instructions outlined here:

auth0 . com/docs/quickstart/webapp/laravel/01-login

Everything works perfectly in my local environment.

However, when I push the repo live using Laravel Forge on a DigitalOcean server and set up a new Application/API for the production environment in the Auth0 tenant dashboard, I run into an issue.

When I click “Login” in the app, the Auth0 authentication flow works—I get redirected, I authenticate successfully—but when I’m redirected back to my app, I’m not logged in.

I’ve added some logging, and it looks like the authentication is successful on Auth0’s side. Any ideas on what might be going wrong?

---

<div class="post-metadata">

**Author:** ![Kely784rey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kely784rey/32/71201_2.png) [@Kely784rey](https://community.auth0.com/u/Kely784rey)\
**Post date:** [April 22, 2025, 4:51am UTC](https://community.auth0.com/t/laravel-integration-working-locally-but-not-in-prod/185707/2 "2025-04-22T04:51:25Z")

</div>

Hello,

Session Storage Issues  
Laravel uses sessions to store the user after Auth0 redirects back.

On your production server, make sure session storage is working:

Check config/session.php

Make sure SESSION\_DRIVER is not array (which is stateless)

Recommended: use file, database, or redis

SESSION\_DRIVER=file  
Ensure storage/framework/sessions/ is writable by the web server.

1. APP\_URL mismatch  
Auth0 redirects back to your app using the callback URL. If APP\_URL is wrong, Laravel might not handle the session correctly.

Make sure this matches your production domain exactly (with https if you’re using SSL):

APP\_URL=  
3. Auth0 Configuration (ENV values)  
Double-check you’ve switched to your production Auth0 App settings:

AUTH0\_DOMAIN=  
AUTH0\_CLIENT\_ID=your\_prod\_client\_id  
AUTH0\_CLIENT\_SECRET=your\_prod\_secret  
AUTH0\_REDIRECT\_URI=  
4. Web Middleware Group  
Ensure the /callback route is in the web middleware group so sessions are available.

Route::get(‘/callback’, ‘\App\Http\Controllers\Auth\Auth0IndexController@callback’)  
-\>middleware([‘web’]);  
5. Check for HTTPS Redirects  
If your site redirects from HTTP to HTTPS, or vice versa, after the Auth0 callback, the session might be lost.

Use HTTPS consistently.

Set this in .env to force secure cookies:

SESSION\_SECURE\_COOKIE=true  
6. Check Logs  
You mentioned adding logs—also check Laravel logs (storage/logs/laravel.log) for exceptions during the callback phase.

Best Regard,  
Kely
