I am writing a PHP script to let users use Twitter to sign in to an app using OAuth 1.0a.
I am having an issue with the request_token API.
The oauth_signature parameter requires an HMAC-SHA1 hash ran on a signing base which has parameters such as request_token URL and my callback URL.
The callback URL
is percent escaped to
https%3A%2F%2Fexample.com%2Fcallback.php
but the request_token call fails unless I percent escape the URL again
https%253A%252F%252Fexample.com%252Fcallback.php
In order for request_token API to work I have to escape the '%' to '%25'.
The request_token URL in the same signing base does not have to escape the percents.
https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token
works OK.
Does Twitter require that the callback URL in the signing base string be percent escaped twice?