Saya telah mencoba menyetel hak AccessTokenLifetime untuk Klien Implisit saya menjadi 90 detik. Klien adalah aplikasi javascript.
Namun, klien masih dapat mengakses cakupan api "api1" selama sekitar 5 menit setelah token kedaluwarsa.
Ini adalah kode untuk konfigurasi klien di IdentityServer4:
// JavaScript Client
new Client
{
ClientId = "js",
ClientName = "JavaScript Client",
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RedirectUris = { "http://localhost:5003/callback.html" },
PostLogoutRedirectUris = { "http://localhost:5003/index.html" },
AllowedCorsOrigins = { "http://localhost:5003" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"api1"
},
AccessTokenLifetime = 90
}
Saya menggunakan solusi mulai cepat Javascript dari repo github IdentityServer di sini https://github.com/IdentityServer/IdentityServer4.Samples/tree/release/Quickstarts/7_JavaScriptClient