Not able to understand oauth/access_token web api method

  1. var client = new RestClient(“”);
    string _consumerKey = ConfigurationManager.AppSettings[“consumerKey”];
    string _consumerSecret = ConfigurationManager.AppSettings[“consumerSecret”];
    1.1 var authenticator = OAuth1Authenticator.ForRequestToken(_consumerKey, _consumerSecret);
    authenticator.ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader;

        client.Authenticator = authenticator;
      1.2  var request = new RestRequest("/oauth/request_token", Method.POST);
        request.AddHeader("oauth_callback", "http%3A%2F%2127.0.0.1%3A1410%2F");
        var response = client.Execute(request);
        var qs = HttpUtility.ParseQueryString(response.Content);
        var _token = qs["oauth_token"];
        var _tokenSecret = qs["oauth_token_secret"];

    1.3 var requestAuthentication = new RestRequest("/oauth/authorize?oauth_token={token}", Method.GET);

        requestAuthentication.AddParameter("token", _token, ParameterType.UrlSegment);
        requestAuthentication.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };
        var queryResult = client.Execute(requestAuthentication);

I am able to do a successful request_token and authorization, but after that what steps I shall follow in order to call oauth/access_token. Please help me out. I am using RestSharp.



Unfortunately I don’t think we can help dig into issues specific to libraries or languages and not the Ads API - please try to post about your issues to an online community such as stackoverflow.

As a tip you can search for “RestSharp” and find many examples.