boatnax.blogg.se

Cpprestsdk oauth example
Cpprestsdk oauth example













The main thread runs an epoll loop in the front-end server. HigLog("EXCEPTION CAUGHT: %s", e.what()) nf.request(methods::POST, U("/"), requestBody) Here is the sample code section of my implementation (only the request sending section). In the URLs there are the following variables used: Callback URL: Īuth URL: **TENANTID**/oauth2/v2.0/authorizeĪccess Token URL: **TENANTID**/oauth2/v2.0/tokenįor the API calls, read about Microsoft Graph REST API v1.I have created a client server system server by following the CppRestSdk examples. Here you can watch all the needed endpoints, secrets etc. So - for authentication, you should use oauth 2.0 example which I pasted above.īecause you need to write everything on your own, please read deeply docs about authentication for MS Graph Accessing the MS Graph API using access token from the authentication process (in the standard process you should use MS Graph SDK)įor the C++ there is no MSAL or SDK library. MS Graph authentication - which is, in fact, Azure Access Directory/Microsoft identity platform authentication, based on oauth 2.0 (short name: MSAL)Ģ. Here you have some code for oauth 2.0 in Dropbox, Linkedin and MS Live scope:ġ. Please let me know if anyone has come across any example / link to achieve the same. 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. 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. String scopes = new string v1.0/users", result.AccessToken, Display) WithAuthority(new Uri(config.Authority)) For example, refer following code from a Microsoft tutorial: AuthenticationConfig config = AuthenticationConfig.ReadFromJsonFile("appsettings.json") īool isUsingClientSecret = AppUsesClientSecret(config) Īpp = ConfidentialClientApplicationBuilder.Create(config.ClientId) In C# I can complete my tasks in a few lines of code. I am trying out Microsoft's C++ Rest SDK ( ) to invoke Graph APIs but it has been a struggle so far.















Cpprestsdk oauth example