spartacus-与碱的api呼叫断路店面加载一起发送的令牌已过期

发布于 2025-01-29 17:05:16 字数 1207 浏览 2 评论 0原文

我们在使用CSR运行的Spartacus B2B 4.2遇到问题,并提早登录启用了OAuth代币到期并打开网站后,显示了一个空白页。

这里进行了模拟的方案:

  1. 用户登录,
  2. 然后,Spartacus将OAuth令牌存储在LocalStorage
  3. 用户中,关闭应用程序和/或浏览器
  4. 第二天,用户返回网站。
  5. spartacus呼叫basesites API,并随请求发送到期的最后
  6. 一个通话失败,spartacus无法弄清网站,没有渲染的内容 - 显示了空白页。
  7. 现在,如果用户刷新页面,则代币将不再发送,并且该页面被成功加载。

我们对项目的身份验证模块没有自定义。

一般信息:

  1. 这是Spartacus B2B App
  2. 版本4.2
  3. 运行CSR
  4. 早期登录已启用( https://sap.github.io/spartacus-docs/early-login/

我们确实有另一个spartacus b2c应用程序,运行相同的版本,但是使用SSR,但该错误并不是该错误。发生。

那么,我的问题是:

  1. 这是版本中的错误吗?
  2. 为什么Spartacus不利用Oauth在登录过程中返回的Oauth刷新代币?根据 https://sap.github.io/spartacus/spartacus-dococs/session-management-management-management /“当请求失败后,因为访问令牌已过期,拦截器使用刷新令牌(如果存在的话)来请求新的访问令牌,然后使用新令牌重新检索失败的请求。 “
  3. 我们应该审查任何配置吗?

谢谢,

阿德里亚诺

We have an issue with Spartacus B2B 4.2 running with CSR and early login enabled that after the oauth token expires and user opens the website, a blank page is displayed.

Here goes the scenario to simulate:

  1. User logs in succesfully
  2. Then, Spartacus stores the oauth token in the localstorage
  3. User closes the application and/or the browser
  4. Next day, user returns to the website.
  5. Spartacus calls the basesites API and sends along with the request the expired token
  6. This last call fails, Spartacus cannot figure the website and nothing is rendered - blank page displayed.
  7. Now, if user refreshes the page, token is not longer sent and the page is loaded succesfully.

We don't have customizations to the authentication module in our project.

General information:

  1. This is Spartacus B2B App
  2. Version 4.2
  3. Running CSR
  4. Early login is enabled (https://sap.github.io/spartacus-docs/early-login/)

We do have another Spartacus B2C App, running same version, but with SSR, that the error doesn't happen.

So, my questions are:

  1. Is this a bug in the version?
  2. Why Spartacus is not leveraging OAuth Refresh token returned during the login process? According to https://sap.github.io/spartacus-docs/session-management/, "When a request fails because the access token has expired, the interceptor uses the refresh token (if it exists) to request a new access token, and then retries the failed request with the new token."
  3. Is there any configuration that we should review?

Thanks,

Adriano

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文