如何保留用户导航到的原始网址?假设我有一个未经身份验证的用户导航到http://localhost:9000/customer/123
要验证用户身份,我会执行以下操作:
// in my app.js
new Oidc.UserManager().signinRedirect({state:'customer/123'}); // need a way to keep this url
当它返回到我需要访问原始网址的 callback.html 时:
// callback.html
<script src="oidc-client.js"></script>
<script>
Oidc.Log.logger = console;
new Oidc.UserManager().signinRedirectCallback().then(function () {
var state = 'customer/123' // how to do a redirect to the page originally requested page?
window.location.href="http://localhost:9000/ + state
}).catch(function (e) {
console.error(e);
});
</script>
或者也许还有其他获取原始网址的方法?
谢谢你的帮助!