【发布时间】:2021-06-28 07:01:50
【问题描述】:
在静默更新时调用连接/授权端点后,它会调用silent_renew.html。但在日志上它返回 OAuthErrorEvent {type: "silent_refresh_timeout", reason: null, params: null}
我有一个 Angular 客户端。 使用silent_renew.html
<!DOCTYPE html>
<html>
<head>
<base href="./" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>silent-renew</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<script>
window.onload = function () {
console.log("Testing" + Date.now());
parent.postMessage(location.hash, location.origin);
};
</script>
</body>
</html>
身份服务器中的客户端设置是
new Client
{
ClientId = app.ClientId,
ClientName = app.ClientName,
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
RequireClientSecret = false,
AlwaysSendClientClaims = true,
AllowOfflineAccess = true,
AllowAccessTokensViaBrowser = true,
AlwaysIncludeUserClaimsInIdToken = false,
RequireConsent = false,
AllowRememberConsent = true,
EnableLocalLogin = false,
IdentityProviderRestrictions = new List<string> {
app.Restrictions
},
AccessTokenLifetime = 60,
RedirectUris =
{
$"{configuration["localAddress"]}",
$"{configuration["localAddress"]}/index.html",
$"{configuration["localAddress"]}/callback.html",
$"{configuration["localAddress"]}/silent-renew.html",
app.ClientAddress,
app.ClientAddress + "/index.html",
app.ClientAddress + "/callback.html",
app.ClientAddress + "/silent-renew.html"
},
PostLogoutRedirectUris =
{
$"{configuration["localAddress"]}",
$"{configuration["localAddress"]}/index.html",
app.ClientAddress,
app.ClientAddress + "/index.html"
},
AllowedCorsOrigins =
{
$"{configuration["localAddress"]}",
app.ClientAddress
},
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
app.ClientCode.ToLower()
}
});
我花了几天的时间试图找出问题所在,因此非常感谢您的帮助。
【问题讨论】:
-
来自 IdentityServer 的日志是怎么说的?
-
@ToreNestenius 感谢您与我们联系。这也是让我困惑的地方。识别服务器为授权端点成功返回,但之后没有请求,也不是连接问题。无论如何,我现在已经更新了silent_renew.html 页面并且它现在可以工作了。
标签: angular identityserver4 openid-connect openid access-token