Skip to main content

Posts

Showing posts from November, 2021

package.json

{ "name": "yammer-auth", "version": "1.0.0", "description": "", "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "lite-server" }, "author": "Sai Prasad Padhy", "devDependencies": { "lite-server": "^2.5.4" } }

Http Client Post Request to get OAuth2 Token Using c#

Http Client Post Request to get Oauth2 Token Using c# string tenentID = "YOUR_TENENT_ID"; string clientID = "CLIENT_ID"; string clientSecret = "YOUR_CLIENT_SECRET"; HttpClient Rclient = new HttpClient(); var Rcontent = new StringContent("grant_type=client_credentials&client_id=clientID&client_secret=clientSecret", Encoding.UTF8, "application/x-www-form-urlencoded"); var result = await Rclient.PostAsync("https://login.microsoftonline.com/tenentID/oauth2/token", Rcontent); string resultContent = await result.Content.ReadAsStringAsync();