# Broken access\_token when calling from .net

**URL:** <https://community.auth0.com/t/broken-access-token-when-calling-from-net/85475>\
**Category:** Get Help\
**Tags:** jwt\
**Created:** [June 20, 2022, 2:17pm UTC](https://community.auth0.com/t/broken-access-token-when-calling-from-net/85475 "2022-06-20T14:17:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nra/32/22743_2.png) [@nra](https://community.auth0.com/u/nra)\
**Post date:** [June 20, 2022, 2:17pm UTC](https://community.auth0.com/t/broken-access-token-when-calling-from-net/85475/1 "2022-06-20T14:17:14Z")

</div>

For some reason, I get a broken access\_token in return when I’m trying to make a user authentication through my .net code.  
Strangely, the exact same call in POSTMAN works like a charm.  
In essence, the broken access\_token returned contains 3 dots like ‘…’ somewhere in token rendering it invalid (verified through [jwt.io](http://jwt.io)).  
Note, that the json has not been truncated since it actually looks complete.  
And the HttpStatusCode == OK

The c# code looks like this:

```auto
            Dictionary<string, string>? dict = new() {
                { "audience", audience },
                { "grant_type", "password" },
                { "username", username },
                { "password", password },
                { "client_id", clientId },
                { "client_secret", clientSecret }
            };
            
            string payload = JsonConvert.SerializeObject(dict);
            HttpRequestMessage? req = new(HttpMethod.Post, url) { Content = new StringContent(payload, Encoding.UTF8, "application/json")};
            HttpResponseMessage? res = await _httpClient.SendAsync(req);
            string result = await res.Content.ReadAsStringAsync();
            return new (result, res.IsSuccessStatusCode );

```

The Postman call looks like this:

```auto
POST {myurl}
Content-Type: application/json
{
    "client_id": "{my client_id},
    "client_secret": "{my_client_secret}",
    "audience": "{my_audience_in_api},
    "username": "{my_username}",
    "password": "{my_password}",
    "grant_type": "password"
}

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 24, 2022, 6:38pm UTC](https://community.auth0.com/t/broken-access-token-when-calling-from-net/85475/3 "2022-06-24T18:38:18Z")

</div>

Hi @nra,

Could you post an example token? You may be getting an opaque token if your audience isn’t making it into the request.

[https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028](https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028)

---

<div class="post-metadata">

**Author:** ![nra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nra/32/22743_2.png) [@nra](https://community.auth0.com/u/nra)\
**Post date:** [June 24, 2022, 8:07pm UTC](https://community.auth0.com/t/broken-access-token-when-calling-from-net/85475/4 "2022-06-24T20:07:29Z")

</div>

Hi Dan.

Thanks for reverting back to me.  
I must admit the fault is on me.  
In VS2022 I was debugging some issues in C# and the debugger played a trick on me when running Blazor limiting the view of the strings.  
So the string variables containing the token seemed to contain broken values, but it turned out that when you Console.Writeline the contents, they actually contain the correct value.

So bottomline: When debugging your Blazor app in VS2022 don’t rely 100% on the visible debugger contents. It has nothing to do with Auth0!

Please close this ticket and bear with me 😊

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 24, 2022, 8:10pm UTC](https://community.auth0.com/t/broken-access-token-when-calling-from-net/85475/5 "2022-06-24T20:10:08Z")

</div>

Thanks for following up on this!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 24, 2022, 8:10pm UTC](https://community.auth0.com/t/broken-access-token-when-calling-from-net/85475/6 "2022-06-24T20:10:13Z")

</div>


