mercredi 20 novembre 2019

Is there a way to change the Header key to X-API-Authorization instead of Authorization when passing token for authenticating the Laravel API's?

I am using Laravel inbuilt Bearer token for API authentication. https://laravel.com/docs/5.8/api-authentication#passing-tokens-in-requests

$response = $client->request('POST', '/api/user', [
    'headers' => [
        'Authorization' => 'Bearer '.$token,
        'Accept' => 'application/json',
    ],
]);

I would like to change the Authorization header to X-API-Authorization since we already have a legacy authentication in place which use this header Authorization, which I have no control over.

Does Laravel provide over-riding this inbuilt functionality?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire