Twitter api 1.1 users/search 403


I have one problem connected with twitter api. I try to search user through twitter api 1.1 in c#. Here is my code:

using (WebClient client = new WebClient())

    client.Headers.Add("Authorization", "Bearer " + GetAccessToken());

    var url = "";

    return client.DownloadString(url);


private string GetAccessToken()
    var tokenPayload = string.Empty;

    using (var wc = new WebClient())
        wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
        wc.Headers.Add("Authorization", "Basic " + GetKeySecretString());

        tokenPayload = wc.UploadString("", "grant_type=client_credentials");

        return ExtractAccessTokenFromResponse(tokenPayload);

But when I try to get response I get 403 forbidden exception. Token is right, because if I search twitts with it works. What am I doing wrong?


I tried to use LINQToTwitter. When I tried to search user I had this exception: Your credentials do not allow access to this resource.


You’re probably using auth and the API correctly, but the users/search method doesn’t support application-only auth – only user accounts can search for other user accounts.


Problem was solved. I sent wrong header. Here is a good article about twitter authentification: