Support the ongoing development of →
posted 1 year ago
Last updated by @yeestrada 1 year ago.

401 error code means that your request is not authenticated.

If you share some code snippets then only we might be able to help you better.


Hi, this is my code, the test always gets te same response 401. Thanks a lot for your help. Here are the code files changed

App\Http\Controllers\AuthController App\User App\Providers\AuthServiceProviders Routes\Api test\Feature\UserTest


@yeestrada can you share the relevant code on the forum? That makes it more useful for other people to read it another time.

I see that the guide you follow use an old Laravel version. Do you use that version (5.6) or the latest?

There are multiple options that result in the 401, it can that you have an auth requirement on the api group (in the RouteServiceProvider) or something else that I didn't directly see.

One thing that I see is that your UserTest does nothing with the database but your AuthController does (the unique validation rule will execute a query to your database) I'm not sure how that error in your validation will return.


Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.