Custom Authentication

rpmg.infinityfreeapp.com/members

Error Message: Target class [authentication] does not exist.

I created a custom authentication for my members page but, when i uploaded it in the hosting, i get this error… though this is working on my local machine. What could be the problem?

i am using laravel framework by the way.

Thank you for any help.

Works fine for me, I downloaded this CSV file just fine:

Number,"Full Name","Email Address","Contact Number","Referral Source","Referred By",Relationship,"Familiar Stations","Date Created"
1,"Rxx Mxxxxxxx",[email protected],0x7x6x1xxxx,"Social media","Sxx Kxxxx",Coworker,"[""FM Radio""]","2024-09-10 14:20:05"
2 Likes

it should have been protected by my middleware but when i use the middleware…it always bring to that error message…

Where is the authentication? page URL, code, etc.

Where do you save the members? in DB?
The connection to the DB is executed without problems?

Or you have not done according to this



Debugging

3 Likes

I wonder why you’d want to write your own authentication when you’re already using Laravel, which has a very well built and flexible authentication system, but that’s not the point.

My hunch is case sensitive file names and class autoloading.

Laravel uses class autoloading so you don’t need to manually require classes from your code. Just reference your class and Composer will import it. To make that work, you are required to have your class and namespace names match the file and directory names.

Windows and MacOS do not have case sensitive file names. So if you have a class named authentication, but call the file Authentication.php, it will just work. But we, like almost all web hosting providers, run Linux servers, which does have case sensitive file names. So the files authentication.php and Authentication.php are actually different files. So again, the class name and file name must match, also in the use of capital letters.

This is a common reason for code that was built locally to not work here. The best way to avoid this is to also develop with a case sensitive system. For Laravel, you could consider developing with Laravel Sail, which uses Docker containers, which are always Linux too.

5 Likes

i just experimented on modifying my authentication because i wanted to get roles and status in the future for adding CMS and was studying laravel middlewares

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