I successfully retrieved an OAuth token then immediately execute the C# code below. I get this exception. What am I doing wrong?
Response: WebException: The remote server returned an error: (401) Unauthorized.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api-sandbox.dwolla.com/");
request.ContentType = "application/vnd.dwolla.v1.hal+json";
request.Accept = "application/vnd.dwolla.v1.hal+json";
request.Headers.Add("Authorization", "Bearer " + Token.Access_token);
var response = (HttpWebResponse)request.GetResponse();
String responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
return responseString;
spencer
(Spencer Hunter - Lead Developer Advocate @ Dwolla)
2
Hi @rtiktin, As part of this request are you specifying the request method? i.e. request.Method = "GET";
I do want to point out that we released a C# client library awhile back which has undergone some recent updates. I’d recommend taking a look at it here to see if it could be useful.
I tried adding request.Method = “GET”; but I’m still getting:
WebException: The remote server returned an error: (401) Unauthorized.
I downloaded the C# example but can’t use it because it uses a higher version of C#.
spencer
(Spencer Hunter - Lead Developer Advocate @ Dwolla)
4
The only other possible issue I see here could be that Access_token should instead be access_token. Thanks for the feedback on the C# client library, we’ll see if we can update that to support a lower version of C#!