ADFS – OAuth Access Token Lifetime in Windows Server 2019

adfsoauthwindows-server-2019

Is it possible to change the access token lifetime in ADFS?

I have an Application Group configured that issues tokens perfectly fine. I just want to know if I can somewhere change the lifetime of access and refresh tokens you get via OAuth.

Only thing I found were some settings about Relaying Party Trusts, but I don't really have those.

Best Answer

I had the same / very similar issue and I wasted a lot of time going through the Internet to find the answer for this.

I think the issue is that most of the docs and blogs online were made using ADFS 2.0 and 3.0 which neither had the Application Group setting (at least true for version 2.0). I believe Win 2016 comes with ADFS 4.0

In short to change the token lifetime for an Application group WebApi, do the following (to set the token lifetime to 60 min for https://relyingtrust.com as an example):

Set-AdfsWebApiApplication -TokenLifetime 60 -TargetIdentifier "https://relyingtrust.com"

For more info refer to Set ADFS Web API Application