How is the JWT created

Ronald Rex 1,666 Reputation points
2021-10-20T19:59:16.77+00:00

I am using the OWIN authentication middleware that comes with Identity Framework in an ASP.Net Web API. I was wondering what code is being executed in the Web API to create the Bearer Token? And once the JWT is created where is it stored. Also can I set the JWT to never expire? Thanks !

Developer technologies | ASP.NET | Other
Microsoft Security | Microsoft Identity Manager
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,926 Reputation points Volunteer Moderator
    2021-10-21T01:54:23.407+00:00

    The middleware only validates the token.

    The oauth authorization server assigns the token. The configuration of this server controls the expiration. For example, with azure ad, you can configure up to 2 hours. Refresh tokens can have longer lifetimes.

    The client calling the middleware stores the token. The client library is configured for storage.

    Note: if the middleware makes a new request with a bearer token, it uses the passed bearer token plus its own credentials to call the oauth server to get a new access token.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.