php - Laravel API Platform authentication doesn't work - Stack Overflow

I have a freshly installed Laravel 11 with api-platformslaravel. The platform has authentication confi

I have a freshly installed Laravel 11 with api-platforms/laravel. The platform has authentication configured via apiToken. After authorization, when trying to make a request via platform, authorization header is not added to it, as a result I get the 401 status. If I send a request from a third-party resource with a correctly added header, authentication is successful, the request is executed correctly.

config/api-platform.php fragment:

    'swagger_ui' => [
        'enabled' => true,
        'apiKeys' => [
            'api' => [
                'type' => 'apiKey',
                'name' => 'Authorization',
                'in' => 'header'
            ]
        ],

    ]

I have a freshly installed Laravel 11 with api-platforms/laravel. The platform has authentication configured via apiToken. After authorization, when trying to make a request via platform, authorization header is not added to it, as a result I get the 401 status. If I send a request from a third-party resource with a correctly added header, authentication is successful, the request is executed correctly.

config/api-platform.php fragment:

    'swagger_ui' => [
        'enabled' => true,
        'apiKeys' => [
            'api' => [
                'type' => 'apiKey',
                'name' => 'Authorization',
                'in' => 'header'
            ]
        ],

    ]
Share Improve this question edited Feb 3 at 22:15 undefined 2,47127 silver badges41 bronze badges asked Jan 31 at 10:01 Максим ШептухаМаксим Шептуха 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Ensure CORS is not blocking your requests. Then, clear config & cache.

php artisan config:clear
php artisan cache:clear

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745270330a4619706.html

相关推荐

  • php - Laravel API Platform authentication doesn't work - Stack Overflow

    I have a freshly installed Laravel 11 with api-platformslaravel. The platform has authentication confi

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信