{"id":1673,"date":"2013-03-21T17:11:00","date_gmt":"2013-03-21T17:11:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2013\/03\/21\/connecting-to-facebook-with-the-c-rest-sdk\/"},"modified":"2019-02-18T18:41:12","modified_gmt":"2019-02-18T18:41:12","slug":"connecting-to-facebook-with-the-c-rest-sdk","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/connecting-to-facebook-with-the-c-rest-sdk\/","title":{"rendered":"Connecting to Facebook with the C++ REST SDK"},"content":{"rendered":"<p>Hi, this is Andy Rich from the C++ QA team.&nbsp; <a href=\"https:\/\/aka.ms\/ConnectWithRestSDK\">Previously<\/a>, I showed you how you can use the <a href=\"http:\/\/casablanca.codeplex.com\/\">C++ REST API<\/a> to connect to Live services, but this is just one of many web services that you can use the REST API with.&nbsp; In this blog post, I will walk you through creating a Windows 8 Store App that will log a user into Facebook and download and display their photo albums.<\/p>\n<h2>Setting up a Facebook Developer Account<\/h2>\n<p>In order to develop apps for Facebook, you will need to have a real Facebook account, and sign up to be a developer on their platform, which you can accomplish by visiting <a href=\"http:\/\/developers.facebook.com\/\">http:\/\/developers.facebook.com<\/a>.<\/p>\n<p>Once you are enrolled as a developer, you will need to create an app identity by clicking &ldquo;Apps&rdquo; in the top bar and choosing &ldquo;Create New App&rdquo;.&nbsp; Give your app a name, but don&rsquo;t worry about setting any of the other parameters for now.&nbsp; Click &ldquo;Save Changes&rdquo; and your app will be created.<\/p>\n<p>You should also set your app to a &ldquo;Desktop&rdquo; app, which will reduce how often your users need to log in.&nbsp; To do this, select &ldquo;Advanced&rdquo; under your application settings, change App Type to &ldquo;Native\/Desktop&rdquo; and set &ldquo;App Secret in Client&rdquo; to &ldquo;No&rdquo; and click the &ldquo;Save Changes&rdquo; button.<\/p>\n<p>Finally, go your basic settings page and make note of your app&rsquo;s App ID\/API key (later referred to as &lt;appid&gt;) and your app secret (later called &lt;appsecret&gt;).&nbsp; We will need these values in future steps.<\/p>\n<p>For the purposes of this post, we will be creating an abstraction to deal with communication with Facebook, a facebook_client class:<\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green;background: white\"> \/\/ Facebook.h<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> #pragma<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> once<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> #include<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\"> &lt;string&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> #include<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\"> &lt;http_client.h&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> #include<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\"> &lt;json.h&gt;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> &nbsp;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> class<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\"> facebook_client<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> {<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> public<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">:<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> static<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\"> facebook_client<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&amp; instance(); <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: green;background: white\"> \/\/ Singleton<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>pplx::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">task<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&lt;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\">void<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&gt; login(std::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">wstring<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> scopes);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>pplx::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">task<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&lt;web::json::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">value<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&gt; get(std::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">wstring<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> path);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> web::http::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">uri_builder<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> base_uri(<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\">bool<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> absolute = <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> false<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> &nbsp;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> private<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">:<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> facebook_client(): <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> raw_client(L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;https:\/\/graph.facebook.com\/&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">),<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> signed_in(<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\">false<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">) {}<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> &nbsp;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>pplx::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">task<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&lt;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\">void<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&gt; full_login(std::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">wstring<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> scopes);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> &nbsp;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>std::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">wstring<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> token_;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> bool<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> signed_in;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> web::http::client::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color:#2b91af;background: white\">http_client<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> raw_client;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> };<\/span><\/p>\n<p>Since we only need one instance of this class for our app, we are employing the singleton pattern and have made the constructor private.&nbsp; This ensures that the client can be accessed from anywhere, and that multiple instances of the client do not proliferate through our app.<\/p>\n<p>The following sections will walk through implementation of this class.&nbsp; The code in the following sections assumes that your implementation file has these using declarations:<\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> using<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> namespace<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> pplx;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> using<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> namespace<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> web;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> using<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> namespace<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> Platform;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> using<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> namespace<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> Windows::Foundation;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> using<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> namespace<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> Windows::Security::Authentication::Web;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> using<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> namespace<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> Windows::Storage;<\/span><\/p>\n<p>The implementation of the instance() method uses a <a href=\"http:\/\/www.devarticles.com\/c\/a\/Cplusplus\/C-plus-plus-In-Theory-The-Singleton-Pattern-Part-I\/4\/\">Meyer&rsquo;s Singleton<\/a>:<\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\"> facebook_client<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&amp; <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\"> facebook_client<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">::instance()<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> {<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> static<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\"> facebook_client<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> c;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\"> return<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> c;<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> }<\/span><\/p>\n<h2>Logging into Facebook<\/h2>\n<p>Like many popular services, Facebook uses <a href=\"http:\/\/oauth.net\/2\/\">OAuth<\/a> to perform user logins.&nbsp; For Windows Store apps, developers should use the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/apps\/BR227025\">WebAuthenticationBroker<\/a> to negotiate OAuth logins.&nbsp; This API presents a trustworthy dialog for your users to consent to connecting your application to the authorizing service which is consistent across all Windows Store apps.&nbsp; This dialog will guide\n your user through Facebook&rsquo;s <a href=\"https:\/\/developers.facebook.com\/docs\/howtos\/login\/login-for-desktop\/\">Desktop App Login<\/a>.<\/p>\n<p>The following code will present a dialog for the user to log into Facebook:<\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> pplx::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">task<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&lt;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue;background: white\">void<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">&gt; <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\"> facebook_client<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">::full_login(std::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">wstring<\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: gray;background: white\"> scopes<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">) <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> {<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>http::<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #2b91af;background: white\">uri_builder<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> login_uri(L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;https:\/\/www.facebook.com\/dialog\/oauth&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> login_uri.append_query(L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;client_id&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">, L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;&lt;appid&gt;&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">); <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: green;background: white\"> \/\/ App id<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> login_uri.append_query(L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;redirect_uri&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">, L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;https:\/\/www.facebook.com\/connect\/login_success.html&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> login_uri.append_query(L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;scope&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">, <\/span> <span style=\"font-size: 9.5pt;font-family: Consolas;color: gray;background: white\"> scopes<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\"> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span> login_uri.append_query(L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;display&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">, L<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: #a31515;background: white\">&#8220;popup&#8221;<\/span><span style=\"font-size: 9.5pt;font-family: Consolas;color: black;background: white\">);<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin-bottom: .0001pt;line-height: normal\"><span style=\"font-size: 9\"><\/span><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, this is Andy Rich from the C++ QA team.&nbsp; Previously, I showed you how you can use the C++ REST API to connect to Live services, but this is just one of many web services that you can use the REST API with.&nbsp; In this blog post, I will walk you through creating a [&hellip;]<\/p>\n","protected":false},"author":280,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1673","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus"],"acf":[],"blog_post_summary":"<p>Hi, this is Andy Rich from the C++ QA team.&nbsp; Previously, I showed you how you can use the C++ REST API to connect to Live services, but this is just one of many web services that you can use the REST API with.&nbsp; In this blog post, I will walk you through creating a [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/1673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/280"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=1673"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/1673\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=1673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=1673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=1673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}