URL change throws Error 401 - Unauthorized (statuses/user_timeline)


#1

Hello!
I’m currently working with the ‘user_timeline’. When I leave the URL “blank” (not passing any parameters into the URL itself (https://api.twitter.com/1.1/statuses/user_timeline.json) it works fine and returns my own timeline without any errors.
As soon as I change the URL (before making the request) it throws me a 401 - Unauthorized error.
There’s no problem whenever I Tweet from my application and the OAuthHeader method I use is exactly identical (Except I changed the POST to GET in the beggining of the signature string).

protected async Task<String> GETRequest(String OAuthHeader, String URL)
{
        ServicePointManager.Expect100Continue = false;

        //URL += $"?screen_name={Uri.EscapeDataString("Twitter")}";
        //Console.WriteLine("URL: " + URL);

        var req = WebRequest.Create(URL) as HttpWebRequest;
        req.Headers.Add("Authorization", OAuthHeader);
        req.Method = "GET";
        req.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";

        var res = req.GetResponse();
        var resStream = res.GetResponseStream();
        using (var sr = new StreamReader(resStream))
            return sr.ReadToEnd();
}

The Signature: GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fstatuses%2Fuser_timeline.json&oauth_consumer_key%3DE%26oauth_nonce%3DI3%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1552075126%26oauth_token%3D9_m%26oauth_version%3D1.0
The OAuthHeader: OAuth oauth_consumer_key="Q_E", oauth_nonce="N_2", oauth_signature_method="HMAC-SHA1", oauth_signature="DD", oauth_timestamp="1552075172", oauth_token="9_m", oauth_version="1.0"
This works without problems in displaying my own timeline - as soon as the URL is modified is when it breaks, anyone knows any solutions? Will gladly provide more details if needed.
Thank you in advance!

EDIT #1: Made the code slightly easier to read
EDIT #2: Removed some useless text.