openid-connect - signinSilent 不起作用(openID Connect)
问题描述
我在我的 React 项目中实现了 oidc。
它适用于signinRedirect
和 to signoutRedirect
,也automaticSilentRenew
设置为 true 并且有效。
问题是它signinSilent
不起作用。
我的授权文件包含所有重定向 uri(redirect_uri、post_logout_redirect_uri、silent_redirect_uri 等)
在页面加载时,我正在调用一个 init() 函数,其中包含使用 oidc 进行静默登录的逻辑:
{
return _mgr
.signinRedirectCallback()
.then(user => {
// if this is a signin redirect action then set the user info
console.log('signinRedirectCallback: Successful redirect signin.', user);
return (_user = user);
})
.catch(error => {
// otherwise this is a page reload
console.log('signinRedirectCallback: Page reload.', error);
// Execute logic to check if the user is still authenticated, it invokes a silent signin call which happens through an iFrame.
return _mgr
.signinSilent({ redirect_uri: _config.oidc.silent_redirect_uri })
.then(user => {
// if user is still authenticated then set the user info
console.log('signinSilent: Page reload. Successful silent signin.', user);
user.profile.given_name = user.profile.preferred_username;
return (_user = user);
})
.catch(error => {
// otherwise unset user info
console.log('signinSilent: Page reload.', error);
_user = null;
return Promise.reject(error);
});
})
}
如何删除此“框架窗口超时”并使静默登录成功?
解决方案
您正在使用哪个授权服务器以及什么令牌存储模型(在内存、会话存储等中)?
它可能与试图呈现登录页面的 AS 相关 - 即使 OIDC 客户端在静默重定向上发送 prompt=none 也是如此。
推荐阅读
- google-sheets - 如何在 Google 表格的表格中找到字符串的最后一个实例
- ethereum - ERC721代币在OpenSea转账时如何执行内部函数?
- javascript - Clickfunnels 与 Coupon Carrier 和 Aweber 的集成
- macos - 安全和隐私以及自修改应用程序
- linux-kernel - CPU 中有多个内核用于一次运行多个线程/进程,还是用于指令级并行?
- javascript - 未定义的获取对象抛出错误?
- java - Java:JSON.simple Parser - 将 BufferedReader 的 readUTF 字符串转换为 Reader
- ios - 从推送通知打开子小部件后,如何从导航堆栈中弹出小部件并刷新父级?
- javascript - 如何使用 Javascript 和处理创建 Google 地图样式缩放
- docker - Docker TS3 Server 中没有用于服务器密码的 docker 环境变量