# How to properly implement Database Sessions in Laravel 11

**URL:** <https://community.auth0.com/t/how-to-properly-implement-database-sessions-in-laravel-11/161433>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [December 11, 2024, 6:55pm UTC](https://community.auth0.com/t/how-to-properly-implement-database-sessions-in-laravel-11/161433 "2024-12-11T18:55:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhines](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jhines/32/59783_2.png) [@jhines](https://community.auth0.com/u/jhines)\
**Post date:** [December 11, 2024, 6:55pm UTC](https://community.auth0.com/t/how-to-properly-implement-database-sessions-in-laravel-11/161433/1 "2024-12-11T18:55:14Z")

</div>

Hello,

I’m attempting to implement Auth0 Authentication with Laravel 11.35. I have it setup properly and working after copying some of the example for Laravel found here:

[https://github.com/auth0/laravel-auth0?tab=readme-ov-file](https://github.com/auth0/laravel-auth0?tab=readme-ov-file)

I am using auth0/login version 7.15.0.

My issue is that I am attempting to use database sessions driver instead of the file sessions driver. I run into an issue where it never completes authentication and begins an infinite loop of login / callback / app.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/e/e/eea4c719719ea748cf6b7dd4140ebe21c1fef44b.png)

Any help would be appreciated, thank you.

---

<div class="post-metadata">

**Author:** ![valerian](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/valerian/32/62115_2.png) [@valerian](https://community.auth0.com/u/valerian)\
**Post date:** [December 12, 2024, 12:04pm UTC](https://community.auth0.com/t/how-to-properly-implement-database-sessions-in-laravel-11/161433/3 "2024-12-12T12:04:49Z")

</div>

Hi @jhines,

Thank you for posting! Welcome to the Auth0 Community.

It sounds like the issue could be related to how Telescope interacts with the Auth0 SDK, causing an infinite loop during authentication. I recommend checking the [Telescope.md documentation on GitHub](https://github.com/auth0/laravel-auth0/blob/main/docs/Telescope.md).

Hope it helps!

Valerian

---

<div class="post-metadata">

**Author:** ![jhines](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jhines/32/59783_2.png) [@jhines](https://community.auth0.com/u/jhines)\
**Post date:** [December 13, 2024, 4:23pm UTC](https://community.auth0.com/t/how-to-properly-implement-database-sessions-in-laravel-11/161433/4 "2024-12-13T16:23:40Z")

</div>

Hello, thanks for the response. For those with this issue in the future.  
I’ve found the solution to my issue following this guide:  
[https://github.com/auth0/laravel-auth0/blob/main/docs/Eloquent.md](https://github.com/auth0/laravel-auth0/blob/main/docs/Eloquent.md)

Following the guide for Auth0 and then reading the Sessions.md unfortunately does not mention that a Eloquent model for the user must be created before the database driver can be used with mysql.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 27, 2024, 4:24pm UTC](https://community.auth0.com/t/how-to-properly-implement-database-sessions-in-laravel-11/161433/5 "2024-12-27T16:24:07Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
