ฉันกำลังติดตามหลักสูตร pluralsight การรักษาความปลอดภัยแอป Angular ด้วย OpenID Connect และ OAuth2 เพื่อเริ่มต้นและทำงานกับ oidc-client ใน Angular แต่ฉันพบปัญหากับโทเค็นการรีเฟรชแบบเงียบซึ่งส่ง
SilentRenewService._tokenExpiring: ข้อผิดพลาดจากการลงชื่อเข้าใช้เงียบ: หน้าต่างเฟรมหมดเวลา t.error
บนเซิร์ฟเวอร์ที่ลูกค้าอยู่
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
}
และการกำหนดค่าบนไคลเอนต์คือ:
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'
};
ฉันพบวิธีแก้ปัญหาที่แนะนำจาก "Sohan" สำหรับปัญหาที่คล้ายกัน ที่นี่ (มีไว้สำหรับ azure AD โดยเฉพาะ) สิ่งนี้จึงทำให้เกิด
หน้าต่างเฟรมหมดเวลา
หรือข้อเสนอแนะในโพสต์นี้ ที่ฉันควรเพิ่มข้อมูลอ้างอิงสำหรับ Silent- เปลี่ยนเส้นทาง.html ไปยังไฟล์ angular.json ของฉัน ซึ่งไม่ได้ช่วยอะไร
ฉันใช้ Angular 7 และบน Chrome Version 73.0.3683.86 (Official Build) (64-bit)