title: Get User Access Token - Facebook Marketing API
body: <p>I'm using RestSharp to make a call to the Facebook API and it's returning the App Access Token.</p>
  
  <p>However I need to return the User Access Token instead as I need this to create offline conversion sets using the Marketing API.</p>
  
  <p>I've given the app all the appropriate permissions and I can verify this using the Access Token Tool.</p>
  
  <p>Can someone help? Thanks</p>
  
  <pre><code>public void getToken(string uriauth, string clientid, string client_secret, string redirect_uri)
      {
  
          RestSharp.Deserializers.JsonDeserializer deserial = new RestSharp.Deserializers.JsonDeserializer();
  
          var client = new RestClient(uriauth);// + "?client_id=" + clientid + "&amp;client_secret=" + client_secret + "&amp;grant_type=client_credentials");
          var request = new RestRequest(Method.POST);
  
          //request.Resource = "{request_string}";
  
          request.AddHeader("cache-control", "no-cache");
          request.AddHeader("content-type", "text/javascript; charset=utf-8");
          request.AddParameter("application/x-www-form-urlencoded", "grant_type=client_credentials&amp;client_id=" + clientid + "&amp;client_secret=" + client_secret, ParameterType.RequestBody);
  
          IRestResponse response = client.Execute(request);
  
          if (response.Content.ToString().Contains("access") == false)
          {
              try
              {
                  throw new System.Exception("Token API doesn't work");
              }
              catch (Exception ex)
              {
                  Dts.Events.FireError(0, "ERROR", ex.Message, null, 0);
                  Dts.TaskResult = (int)ScriptResults.Failure;
                  return;
              }
          }
          else
          {
              Token returnData = deserial.Deserialize&lt;Token&gt;(response);
  
              if (returnData.access_token != null)
              {
                  access_token = returnData.access_token;
              }
          }
      }
  </code></pre>