# Getting access to decoded JWT in ASP.NET Core 3.1

**URL:** <https://community.auth0.com/t/getting-access-to-decoded-jwt-in-asp-net-core-3-1/50639>\
**Category:** Get Help\
**Tags:** aspnet-core, auth0\
**Created:** [September 29, 2020, 10:35am UTC](https://community.auth0.com/t/getting-access-to-decoded-jwt-in-asp-net-core-3-1/50639 "2020-09-29T10:35:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark.norgate1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mark.norgate1/32/12776_2.png) [@mark.norgate1](https://community.auth0.com/u/mark.norgate1)\
**Post date:** [September 29, 2020, 10:35am UTC](https://community.auth0.com/t/getting-access-to-decoded-jwt-in-asp-net-core-3-1/50639/1 "2020-09-29T10:35:38Z")

</div>

Hi there

I have an [ASP.NET](http://ASP.NET) Core 3.1 backend using SignalR to communicate with clients, rather than [ASP.NET](http://ASP.NET) Core controllers. I am struggling to get access to the JWT, in particular, the `sub` from the JWT which I need. The example code given for an [ASP.NET](http://ASP.NET) Core app doesn’t include accessing the `sub` from the JWT, although the quickstart includes a folder `01 - authorization`, which gives me hope that there’s a subsequent example with some more juicy goodness. Am I right in thinking this?

In any event, perhaps I should start from the basics. How do I access the `sub` from the JWT in [ASP.NET](http://ASP.NET) Core 3.1 controllers? Perhaps then I will have a better idea of how I’m going to access them from within my SignalR hubs.

I created a Stackoverflow post for this issue here: [https://stackoverflow.com/questions/64108175/auth0-netcoreapp-3-1-and-signalr-obtaining-decoded-jwt](https://stackoverflow.com/questions/64108175/auth0-netcoreapp-3-1-and-signalr-obtaining-decoded-jwt)

Any help greatly appreciated!

Mark

---

<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:** [September 29, 2020, 4:42pm UTC](https://community.auth0.com/t/getting-access-to-decoded-jwt-in-asp-net-core-3-1/50639/3 "2020-09-29T16:42:58Z")

</div>

Hi @mark.norgate1,

Welcome back to the Community!

Have you looked at our API docs that show how to decode a token? It looks like there is an example of getting the sub claim in there too.

> **[Auth0 ASP.NET Core Web API SDK Quickstarts: Authorization](https://auth0.com/docs/quickstart/backend/aspnet-core-webapi#configure-the-middleware)**
>
> This tutorial demonstrates how to add authorization to an ASP.NET Core Web API application using the standard JWT middleware.

Let me know if it helps,  
Dan

---

<div class="post-metadata">

**Author:** ![mark.norgate1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mark.norgate1/32/12776_2.png) [@mark.norgate1](https://community.auth0.com/u/mark.norgate1)\
**Post date:** [September 29, 2020, 10:39pm UTC](https://community.auth0.com/t/getting-access-to-decoded-jwt-in-asp-net-core-3-1/50639/4 "2020-09-29T22:39:40Z")

</div>

Hi there Dan

I don’t really know how or why, but I just tried to run my app again after reading through your post, and it is now working. Perhaps because now I am using `Context.UserIdentidier` rather than `Context.User`.

Anyway, it’s working now and I’m happy again, so thank you!

Mark

---

<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:** [September 30, 2020, 3:58pm UTC](https://community.auth0.com/t/getting-access-to-decoded-jwt-in-asp-net-core-3-1/50639/5 "2020-09-30T15:58:04Z")

</div>

Glad it was solved! Let us know if you have any other questions.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 15, 2020, 3:58pm UTC](https://community.auth0.com/t/getting-access-to-decoded-jwt-in-asp-net-core-3-1/50639/6 "2020-10-15T15:58:17Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
