How do I add a route prefix to authentication routes exposed by Laravel JetStream? For example, I want to move the default /login
route to /api/login
(and similarly /register
and /logout
routes). I could do this Passport through a config option, but no such things appears to be there in JetStream.
Asked
Active
Viewed 2,820 times
2

dotNET
- 33,414
- 24
- 162
- 251
1 Answers
6
there is a simple solution but its undocumented. you just have to go to your fortify.php config file and add a path. like:
return [
.
.
.
'path' => 'api',
// rest of your config
];

TEFO
- 1,432
- 9
- 23
-
4ah Fortify... they have made it so confusing with all those packages. People coming from old versions of Laravel become confused about the roles of Sanctum, Fortify, Laravel/UI, Passport and JetStream and which of them is used for regular website, which one of APIs, which one provides just the backend functionality and which one contains views. Wish Laravel documentation provides this info in detail. Thanks for the answer though. I'll try it shortly. – dotNET Sep 22 '20 at 05:45
-
1yes its too much but taylor(creator of laravel) want to keep community fresh and that is very very important. adam(creator of tailwind) known long time in laravel community but two new people introduced and that is a message to rest of us if you build good software you will be in top :) – TEFO Sep 22 '20 at 05:55
-
1@tefo - Thanks! Looks like they may have dated it too. I just had to add to prefix in fortify.php. ```'prefix' => 'api',```. -> ```http://example.test/api/login```. Don't forget to run php artisan config:cache! – Ryan M Jan 19 '21 at 00:18