我在我的客户端中使用oidc-client-js进行我的一个 SPA 项目。我有一个用 IdentityServer4 编写的身份服务器。
如果我手动更改服务器的日期时间,则oidc-client-js无法验证登录用户中服务器的响应,因为日期时间不一样。
而且,如果我手动更改客户端的日期时间并使用自动日期时间选项保留服务器,来自服务器的响应再次无效。
我认为任何使用日期时间的 JavaScript 解决方案都不可靠,所有日期时间都必须在服务器中验证。
如何在服务器而不是客户端验证令牌?
我的假设是否正确?如果它不正确,oidc-client-js是否有任何解决方案可以使用服务器时间而不是浏览器时间?
这是我的客户端配置
const userManagerConfig = {
client_id: '58bdb6b3dd264200a1186573a8abf884',
redirect_uri: `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}/authentication/callback`,
response_type: 'code',
post_logout_redirect_uri: `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}`,
scope: 'openid profile phone tes.api',
authority: `http://localhost:5016`,
silent_redirect_uri: `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}/authentication/silent_callback`,
automaticSilentRenew: true,
filterProtocolClaims: true,
loadUserInfo: true,
triggerAuthFlow : true
};