you know, Laravel Passport have predefined routes as folllow:
php artisan route:list
+--------+----------+-----------------------------------------+------+---------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+-----------------------------------------+------+---------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | POST | oauth/authorize | | ...\ApproveAuthorizationController@approve | web,auth |
| | GET|HEAD | oauth/authorize | | ...\AuthorizationController@authorize | web,auth |
| | DELETE | oauth/authorize | | ...\DenyAuthorizationController@deny | web,auth |
| | GET|HEAD | oauth/clients | | ...\ClientController@forUser | web,auth |
| | POST | oauth/clients | | ...\ClientController@store | web,auth |
| | PUT | oauth/clients/{client_id} | | ...\ClientController@update | web,auth |
| | DELETE | oauth/clients/{client_id} | | ...\ClientController@destroy | web,auth |
| | GET|HEAD | oauth/personal-access-tokens | | ...\PersonalAccessTokenController@forUser | web,auth |
| | POST | oauth/personal-access-tokens | | ...\PersonalAccessTokenController@store | web,auth |
| | DELETE | oauth/personal-access-tokens/{token_id} | | ...\PersonalAccessTokenController@destroy | web,auth |
| | GET|HEAD | oauth/scopes | | ...\ScopeController@all | web,auth |
| | POST | oauth/token | | ...\AccessTokenController@issueToken | throttle |
| | POST | oauth/token/refresh | | ...\TransientTokenController@refresh | web,auth |
| | GET|HEAD | oauth/tokens | | ...\AuthorizedAccessTokenController@forUser | web,auth |
| | DELETE | oauth/tokens/{token_id} | | ...\AuthorizedAccessTokenController@destroy | web,auth |
+--------+----------+-----------------------------------------+------+---------------------------------------------+--------------+
Is it possible to modify that route?
e.g. oauth/authorize
become api/v1/oauth/authorize
if yes, how?
I've been searching for answer quite sometime...
The "tymondesigns/jwt-auth" is a PHP Laravel implementation of the JWT protocol. On the other hand, Passport also uses JWT by default plus a huge extra, a complete Oauth2 implementation. Regarding the functionality, as I said they both use JWT thus you can use whichever you like to authentication via tokens.
Chatty Cathy @vincent15000 Passport is an OAuth server implementation, and used to offer OAuth authorisation for your application. Sanctum is an authentication library for “simpler” token-based authentication for clients that need it (i.e. mobile apps) but also offers cookie-based authentication for SPAs.
Laravel Passport is an OAuth 2.0 server implementation for API authentication using Laravel. Since tokens are generally used in API authentication, Laravel Passport provides an easy and secure way to implement token authorization on an OAuth 2.0 server.
The Default Route Files All Laravel routes are defined in your route files, which are located in the routes directory. These files are automatically loaded by your application's App\Providers\RouteServiceProvider . The routes/web.php file defines routes that are for your web interface.
Yes, it is. You can declare your own routes in Passport::routes()
method.
Include this inside the boot()
method of your app/Providers/AuthServiceProvider
file.
app/Providers/AuthServiceProvider.php
public function boot()
{
Passport::routes(null, ['prefix' => 'api/v1/oauth']);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With