Home > Software engineering >  How to call API in laravel which include the OAuth key and secret
How to call API in laravel which include the OAuth key and secret

Time:10-18

I want to call external API from laravel HttpClient. I'm not understanding how to pass the following authorization keys of OAuth 1.0.

1. Signature Method
2. Consumer Key
3. Consumer Secret
4. Access Token
5. Token Secret
6. Version
7. Realm

is this the right way?

$response = Http::withHeaders([
    'Signature Method' => 'Signature Method',
    'Consumer Key' => 'Consumer Key'
])->post('http://test.com/users', [
    'name' => 'Taylor',
]);

enter image description here

Thank you

CodePudding user response:

You can use laravels own HTTP client or you can also use CURL the simplest workaround is you can simply call the request in the Postman and then there is a section in postman where you can find the request center image description hereode there you can simply copy the request code and post it.

  • Related