Last active
April 18, 2018 15:23
-
-
Save teocomi/fec12ab8ccb944d8a785 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
//using DotNetOpenAuth and RestSharp | |
WebServerClient client = new WebServerClient( | |
new AuthorizationServerDescription | |
{ | |
TokenEndpoint = new Uri("https://myurl/oauth"), | |
ProtocolVersion = ProtocolVersion.V20 | |
}, "client", "secret"); | |
var token = client.GetClientAccessToken(); | |
var restclient = new RestClient("https://myurl/endpoint"); | |
RestRequest request = new RestRequest() { Method = Method.GET }; | |
request.AddHeader("Authorization", "Bearer " + token.AccessToken); | |
request.AddHeader("Content-Type", "application/json"); | |
restclient.Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(token.AccessToken); | |
var response = restclient.Execute(request); |
kmorin
commented
Feb 16, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment