Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
JWT token usage

I am using IdentitySercer4 with my .net application. I have IDS running and dishing out JWT tokens, an API endpoint protected with JWT and a Website.

Q. My website goes to IDS to get the token and can now call the API endpoint. But what do I do next? Surely I don't go back to IDS for another token for every call? Do I save my JWT token - either Db or cookie? and then present it every time. When is the check carried out to see if the JWT token has expired so the client goes back to IDS to get a new token?

Thanks

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You cache your token in the client and present it in the Authorization header in every request. The resource server (your API) validates the token during every request. At first, it checks the signature under the token by using the public key (the token is signed by the private key only known to the Identity Server). If the signature is valid, then it checks other stuff like the expiration date. The public key is obtainable from the URI /.well-known/openid-configuration of your IdentityServer. The resource server (your API) shouldn't call this endpoint every request, it should cache the public key instead. If your API is written in .NET, you should consider using the default authentication middleware implementation and setting Authority to point to your IdentityServer, this way token validation will be working out of the box.

services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddJwtBearer(options =>
    {
        options.Authority = "<IdentityServerAddress:Port>";
    })
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda