Support the ongoing development of Laravel.io →
posted 2 years ago
API
Last updated by @yeestrada 2 years ago.
0

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.

0

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

https://drive.google.com/file/d/1DLsLV1L1eONrRiUxVRRcHFb1HWbkO11Y/view?usp=sharing

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

0
moderator

@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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.