title: Microsoft C++ Rest SDK for Graph APIs
body: <p>I am trying out Microsoft's C++ Rest SDK (<a href="https://microsoft.github.io/cpprestsdk/index.html" rel="nofollow noreferrer">https://microsoft.github.io/cpprestsdk/index.html</a>) to invoke Graph APIs but it has been a struggle so far. </p>
  
  <p>In C# I can complete my tasks in a few lines of code. For example, refer following code from a Microsoft tutorial:</p>
  
  <pre><code>        AuthenticationConfig config = AuthenticationConfig.ReadFromJsonFile("appsettings.json");
  
          bool isUsingClientSecret = AppUsesClientSecret(config);
  
          IConfidentialClientApplication app;
  
          if (isUsingClientSecret)
          {
              app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
                  .WithClientSecret(config.ClientSecret)
                  .WithAuthority(new Uri(config.Authority))
                  .Build();
          }           
  
  
          string[] scopes = new string[] { $"{config.ApiUrl}.default" }; 
  
          AuthenticationResult result = null;
          try
          {
              result = await app.AcquireTokenForClient(scopes)
                  .ExecuteAsync();                
          }
          catch (MsalServiceException ex) when (ex.Message.Contains("AADSTS70011"))
          {
          }
  
          // config.ApiUrl is set to "graph.microft.com"
          if (result != null)
          {
              var httpClient = new HttpClient();
              var apiCaller = new ProtectedApiCallHelper(httpClient);
              await apiCaller.CallWebApiAndProcessResultASync($"{config.ApiUrl}v1.0/users", result.AccessToken, Display);
  
          }
  </code></pre>
  
  <p>Now for cross-platform support, I need to develop similar functionality in C++ and for this purpose, we are exploring C++ Rest SDK from Microsoft. But I am unable to find any good examples to achieve a simple thing like providing client ID, client secret to get access token and to authorize.</p>
  
  <p>Please let me know if anyone has come across any example / link to achieve the same.</p>