zl程序教程

您现在的位置是:首页 >  其他

当前栏目

关于 SAP Spartacus Oauth token 过期时间的处理和测试场景

SAP测试 处理 时间 关于 场景 过期 Spartacus
2023-09-14 09:02:58 时间

I use Spartacus 3.1.1 + Commerce 2011 setup locally. I change oauth2.accessTokenValiditySeconds to 30 so that token expires in 30 seconds.

What I observe:

Scenario 1: After successfully logged in, wait for 30 seconds. Then perform whatever actions in Spartacus.

Result:There is first a 401 error for InvalidTokenError, Access token expired.

then a new token is retrieved automatically via POST to https://localhost:9002/authorizationserver/oauth/token. End user is NOT aware of this, the operation in UI goes smoothly.

Scenario 2: wait for 30 seconds, press F5 to refresh the page in Chrome.

result: there are lots of 401 and 400 error in Chrome console:




And there is an empty screen in UI. Nothing displays.

更多Jerry的原创文章,尽在:“汪子熙”: