Home > OS >  How can i customize laravel middleware 'auth:api'?
How can i customize laravel middleware 'auth:api'?

Time:10-22

I want to customize my auth middleware that secure my endpoint.

for example, i want to accept requests that have specific bearer token. how can i do?

i'm using dingo api library.

CodePudding user response:

Go to kernel.php file in HTTP directory. You'll see something like this.

    'auth' => ExampleClass::class,

Find the ExampleClass and read its handle method. After you figure it out how it works, create your own middleware and implement your own logic in it. Read the laravel middlewares document for more information.

CodePudding user response:

I found this very helpfull when i was doing something similar:

https://dev.to/grantholle/implementing-laravel-s-built-in-token-authentication-48cf

  • Related