【发布时间】:2020-10-23 06:38:21
【问题描述】:
我在我的 React 项目中实现了 OIDC。当我在 ios 7/8 中启动我的应用程序时,我得到一个空白屏幕。 在其他更高版本中它工作正常。
我在 index.tsx 中调用了一个 init() 函数:
/**
* Initialize Auth module.
* @param {Object} config Configuration options.
* @returns {Promise<User>} A promise with the user data.
*/
init(config) {
/* main configuration */
.
.
.
.
return _run() // Removing this function call makes the app work fine on iOS 7/8
.then(() => {
return _user;
})
.catch(error => {
return _user;
});
}
这个_run()函数定义为:
function _run() {
return _mgr
.signinRedirectCallback()
.then(user => {
// if this is a signin redirect action then set the user info
Logger.info('signinRedirectCallback: Successful redirect signin.', user);
return (_user = user);
})
.catch(error => {
// otherwise this is a page reload
Logger.info('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
Logger.info('signinSilent: Page reload. Successful silent signin.', user);
return (_user = user);
})
.catch(error => {
// otherwise unset user info
Logger.info('signinSilent: Page reload.', error);
_user = null;
return Promise.reject(error);
});
})
}
如果我从我的 init() 函数中删除 _run() 函数调用,该应用开始在 iOS 7/8 上正常运行。
是什么导致了这个问题,我怎样才能使它适用于 iOS 7/8?
提前致谢。
【问题讨论】:
标签: javascript ios openid-connect