Skip to content

Commit 0c8053d

Browse files
committed
fix auth guards, fix handle api request
1 parent d8b13e1 commit 0c8053d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ APP_LOCALE=en
1212
APP_FALLBACK_LOCALE=en
1313
APP_FAKER_LOCALE=en_US
1414

15-
AUTH_GUARD=sanctum
15+
AUTH_GUARD=api
1616

1717
APP_MAINTENANCE_DRIVER=file
1818
APP_MAINTENANCE_STORE=database

bootstrap/app.php

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* Format not found responses
3232
*/
3333
$exceptions->render(static function (NotFoundHttpException $e, Request $request) {
34-
if ($request->is('api/*')) {
34+
if ($request->is('api*')) {
3535
return response()->json([
3636
'ok' => false,
3737
'message' => $e->getMessage(),
@@ -43,7 +43,7 @@
4343
* Format unauthorized responses
4444
*/
4545
$exceptions->render(static function (AuthenticationException $e, Request $request): \Illuminate\Http\JsonResponse | \Illuminate\Http\RedirectResponse {
46-
if ($request->is('api/*')) {
46+
if ($request->is('api*')) {
4747
return response()->json([
4848
'ok' => false,
4949
'message' => __('Unauthenticated.'),

config/auth.php

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
'driver' => 'session',
4141
'provider' => 'users',
4242
],
43+
'api' => [
44+
'driver' => 'sanctum',
45+
'provider' => 'users',
46+
],
4347
],
4448

4549
/*

0 commit comments

Comments
 (0)