Created
March 4, 2014 14:43
-
-
Save joaomoreno/9347693 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Ping(string authorizationCode) { | |
var client = new WebClient { BaseAddress = string.Format("ACS_URL") }; | |
var values = new NameValueCollection | |
{ | |
{"code", authorizationCode}, | |
{"grant_type", "authorization_code"}, | |
{"redirect_uri", "REDIRECT_URI"}, | |
{"client_id", "SERVICE_USERNAME"}, | |
{"client_secret", "SERVICE_USERKEY"}, | |
{"scope", "RELYING_PARTY_REALM"}, | |
}; | |
var responseBytes = client.UploadValues("/v2/OAuth2-13", "POST", values); | |
var response = Encoding.UTF8.GetString(responseBytes); | |
var result = JsonConvert.DeserializeObject<JwtToken>(response); | |
var accessToken = result.AccessToken; | |
var req = (HttpWebRequest)WebRequest.Create("WEB_APP_URL"); | |
req.Headers.Add("Authorization", string.Format("Bearer {0}", accessToken)); | |
var response2 = (HttpWebResponse)req.GetResponse(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment