Skip to content
Advertisement

Using OAuth 1.0 with PHP cUrl

I am working on a small PHP script which calls an API. This API uses OAuth 1.0 authorization. Hence I need to create the signature and request-header. I am pretty sure my signature-generation method and the generation of the request-header work well as I have done the same in C# (where the everything works) and the signature as well as the header look quite the same.

Generating signature:

JavaScript

Generating authorization header:

JavaScript

I got stuck at the point of passing the authorization header over to the API I am calling.

Setting the authorization:

JavaScript

Finally, when I make the request I get the response, that a parameter is missing.

Advertisement

Answer

Fixed my problem with the help of this tutorial. Moreover, I forgot removing the query parameters from the url used to create the sigunature, which probably was the main problem.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement