Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

francisceril's avatar

Custom Authentication Laravel 6

Hello,

I just started learning Laravel and don't really know much about it. Would appreciate if someone clears this for me.

I have an existing Oracle database, specifically, I just need to access the Employees table for authentication. I already implemented the connection using yajra\laravel-oci8 and tested working. What I don't know now is how to make the whole authentication process. Every tutorial I can find is using the internal database which uses email and password fields from a users table. What if I have a different table? Where would I declare this? I'm guessing I need a custom auth controller, not really sure.

Can anyone one just explain in layman's term how to basically implement a Login authentication using a different table and fields.

Thanks.

0 likes
3 replies
jlrdw's avatar

If you still want the neat build in things like:

Auth::user()->id

You need to somehow "piggy back" the login to a laravel users table and have a login through code of those fields.

Remember, it does not have to be email, it just needs to be "somefield", and a password field.

But is your other database using bcrypt.

Otherwise you may have to completely have custom Authentication and authorization.

You can consider other searches, via google:

site:laracasts.com your search

As several custom Auth topics have come up in the past.

francisceril's avatar

@jlrdw

Hi,

Let's say I would stick with option 1 and just "piggy back" the existing external DB table to my Laravel local DB table. How would I actually do that? How do I sync the changes made at the external database? And do you think this is would be the "best" way to handle my initial issue?

The password on the external database is encrypted but not via bcrypt. I already made a PHP function to decrypt it.

Yes, I also did a lot of searching inside Laracasts but didn't find a "guide" post specific for beginners. I mean most are user issues which I am not able to see how and where they specify their tables or SQL queries. I'm really new to PHP and Laravel. Though I've been using PHP with Kirby CMS and WordPress.

I hope @jeffreyway would make a video post for this topic. Even if it's a paid series. I think it's really helpful for beginners with specific project requirements.

jlrdw's avatar

If you would search as I showed above there was some scenarios where this type of stuff was done, Namely changing md5 to bcrypt. I don't have those links.

Like John has a login in the old system with a password, you match that in the new system with username being the same (but unique) but has to use bcrypt password.

It's just a matter of a match and chain from getting that data from the other user table and matching it up with laravel user table.

Sorry it's just hard to explain this stuff in a post but I think you just think it through you're just doing the actual login in laravel via code, the user isn't actually logging in twice.

But the part about fixing the the bcrypt is a separate process.

Like have a checkbox (or some field) in the user table, and once fixed and bcrypt is set up that can be checked off so it is not repeated.

But yes so hard to explain this in a post.

And of course you will need quite a bit of custom code to make this work.

It would be hard to do a video on this stuff since each situation is unique.

Seems like also you could just use a laravel user a table, and once logged in redirect to Oracle tables as needed.

Obviously there's more than one way to do this.

But however you decide, use at least bcrypt, md5 is not good.

Please or to participate in this conversation.