# OAuth Token Not Working

**URL:** <https://discuss.dwolla.com/t/oauth-token-not-working/4540>\
**Category:** API Support\
**Created:** [November 14, 2017, 12:26am UTC](https://discuss.dwolla.com/t/oauth-token-not-working/4540 "2017-11-14T00:26:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtiktin](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@rtiktin](https://discuss.dwolla.com/u/rtiktin)\
**Post date:** [November 14, 2017, 12:26am UTC](https://discuss.dwolla.com/t/oauth-token-not-working/4540/1 "2017-11-14T00:26:25Z")

</div>

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;
```

---

<div class="post-metadata">

**Author:** ![spencer](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/spencer/32/2143_2.png) [@spencer](https://discuss.dwolla.com/u/spencer)\
**Post date:** [November 16, 2017, 12:38am UTC](https://discuss.dwolla.com/t/oauth-token-not-working/4540/2 "2017-11-16T00:38:42Z")

</div>

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](https://github.com/Dwolla/dwolla-v2-csharp) to see if it could be useful.

---

<div class="post-metadata">

**Author:** ![rtiktin](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@rtiktin](https://discuss.dwolla.com/u/rtiktin)\
**Post date:** [November 16, 2017, 11:38pm UTC](https://discuss.dwolla.com/t/oauth-token-not-working/4540/3 "2017-11-16T23:38:53Z")

</div>

Hi Spencer,

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#.

---

<div class="post-metadata">

**Author:** ![spencer](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/spencer/32/2143_2.png) [@spencer](https://discuss.dwolla.com/u/spencer)\
**Post date:** [January 3, 2018, 7:25pm UTC](https://discuss.dwolla.com/t/oauth-token-not-working/4540/4 "2018-01-03T19:25:29Z")

</div>

> [@rtiktin](#):
>
> Token.Access\_token

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#!

---

<div class="post-metadata">

**Author:** ![rtiktin](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@rtiktin](https://discuss.dwolla.com/u/rtiktin)\
**Post date:** [January 3, 2018, 11:56pm UTC](https://discuss.dwolla.com/t/oauth-token-not-working/4540/5 "2018-01-03T23:56:47Z")

</div>

Thanks —I’ll try it. —Ross
