Search code examples
asp.net-coreidentityserver4

How to issue tokens with typ: jwt instead of at+jwt in Identity Server 4?


Identity Server 4 in contrary to Identity Server 3 issues tokens with default value "typ": "at+jwt", however I still need to issue older version of token, meaning "typ": "jwt".

Is there any way to overwrite default configuration of IS4 and issue JWT token of "typ": "jwt"?


Solution

  • Just change the AccessTokenJwtType on AddIdentityServer:

    var builder = services.AddIdentityServer(options =>
                {
                    // see https://identityserver4.readthedocs.io/en/latest/topics/resources.html
                    options.EmitStaticAudienceClaim = true;
                    options.AccessTokenJwtType = "JWT";
                })
    

    Here I explained it in my blog post as well