Cordova 在OAuth 2.0身份验证之后,是否应该清除InAppBrowser缓存和会话缓存?
标题确实说明了一切,但当然会提供一些关于这个问题的细节 背景 我的Ionic3应用程序正在使用OAuth 2.0进行身份验证。以下是流程:Cordova 在OAuth 2.0身份验证之后,是否应该清除InAppBrowser缓存和会话缓存?,cordova,ionic-framework,oauth-2.0,cordova-plugins,openid-connect,Cordova,Ionic Framework,Oauth 2.0,Cordova Plugins,Openid Connect,标题确实说明了一切,但当然会提供一些关于这个问题的细节 背景 我的Ionic3应用程序正在使用OAuth 2.0进行身份验证。以下是流程: 用户单击登录 此时将打开InAppBrowser Web视图,将它们定向到OpenID Connect登录门户页面 成功登录后,将调用重定向url并发送验证码 应用程序(使用事件侦听器)看到带有验证码的url,然后强制关闭InApp浏览器并获取验证码 然后,应用程序将该验证码发送到服务器应用程序,以获取令牌集(访问令牌、刷新令牌等),并验证/验证它们是否未被
webview = window.cordova.InAppBrowser.open(openIdUrl, '_blank', 'location=no,clearcache=yes,clearsessioncache=yes');
webview.addEventListener('loadstart', (event) => {
if(event.url.inclues('redirect://?code')) {
// Grab auth_code in event.url
...
webview.removeEventListener('exit', () => {})
webview.close();
// Send auth_code to my server
...
}
});
webview = window.cordova.InAppBrowser.open(openIdUrl, '_blank', 'location=no,clearcache=no,clearsessioncache=no');
webview.addEventListener('loadstart', (event) => {
if(event.url.inclues('redirect://?code')) {
// Grab auth_code in event.url
...
webview.removeEventListener('exit', () => {})
webview.close();
// Send auth_code to my server
...
}
});
未清除的示例:
webview = window.cordova.InAppBrowser.open(openIdUrl, '_blank', 'location=no,clearcache=yes,clearsessioncache=yes');
webview.addEventListener('loadstart', (event) => {
if(event.url.inclues('redirect://?code')) {
// Grab auth_code in event.url
...
webview.removeEventListener('exit', () => {})
webview.close();
// Send auth_code to my server
...
}
});
webview = window.cordova.InAppBrowser.open(openIdUrl, '_blank', 'location=no,clearcache=no,clearsessioncache=no');
webview.addEventListener('loadstart', (event) => {
if(event.url.inclues('redirect://?code')) {
// Grab auth_code in event.url
...
webview.removeEventListener('exit', () => {})
webview.close();
// Send auth_code to my server
...
}
});
clearcache:设置为“是”,以便在打开新窗口之前清除浏览器的cookie缓存
clearsessioncache:设置为“是”,以便在打开新窗口之前清除会话cookie缓存
非常感谢您提供任何明确的答案/知识。这个空间非常新。我有确切的笑脸流。当我使用clearcache作为no.。我获得oauth访问被拒绝错误