Saya mengikuti kursus pluralsight Mengamankan Aplikasi Angular dengan OpenID Connect dan OAuth2 untuk memulai dan menjalankan dengan oidc-client di Angular, tetapi saya menemukan masalah dengan token penyegaran senyap, yang menyebabkan
SilentRenewService._tokenExpiring: Kesalahan dari signinSilent: Batas waktu jendela bingkai habis t.error
di server klien berada
new Client
{
ClientId = "spa-client",
ClientName = "Projects SPA",
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RequireConsent = false,
RedirectUris = {
"http://localhost:4200/assets/oidc-login-redirect.html",
"http://localhost:4200/assets/silent-redirect.html"
},
PostLogoutRedirectUris = { "http://localhost:4200/?postLogout=true" },
AllowedCorsOrigins = { "http://localhost:4200/" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"projects-api"
},
IdentityTokenLifetime=30,
AccessTokenLifetime=30
}
dan konfigurasi pada klien adalah:
var config = {
authority: 'http://localhost:4242/',
client_id: 'spa-client',
redirect_uri: 'http://localhost:4200/assets/oidc-login-redirect.html',
scope: 'openid projects-api profile',
response_type: 'id_token token',
post_logout_redirect_uri: 'http://localhost:4200/?postLogout=true'
userStore: new WebStorageStateStore({ store: window.localStorage }),
automaticSilentRenew: true,
silent_redirect_uri: 'http://localhost:4200/assets/silent-redirect.html'
};
Saya menemukan solusi yang disarankan dari "Sohan" untuk masalah serupa di sini (ini khusus untuk Azure AD). Hal ini kemudian menyebabkan
Batas waktu jendela bingkai habis
Atau saran di postingan ini agar saya menambahkan referensi untuk silent- redirect.html ke file Angular.json saya, ini tidak membantu
Saya menggunakan Angular 7 dan Chrome Version 73.0.3683.86 (Official Build) (64-bit)