@yelon/bis 15.2.2 → 15.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1860,30 +1860,11 @@ class YunzaiAuthService {
1860
1860
  }
1861
1861
  askToken() {
1862
1862
  log$1('yz.auth.service: ', 'askToken');
1863
- if (this.tokenService.get()?.token) {
1864
- const notCovertToken = this.tokenService.get();
1865
- let convertedToken;
1866
- if (notCovertToken && notCovertToken['access_token']) {
1867
- convertedToken = {
1868
- token: notCovertToken['access_token'],
1869
- expired: notCovertToken['expires_in'],
1870
- refreshToken: notCovertToken['refresh_token'],
1871
- scope: notCovertToken['scope'],
1872
- tokenType: notCovertToken['token_type']
1873
- };
1874
- return of(convertedToken);
1875
- }
1876
- else {
1877
- return of(this.tokenService.get());
1878
- }
1863
+ if (this.config.loginForm) {
1864
+ return this.fetchTokenByUP();
1879
1865
  }
1880
1866
  else {
1881
- if (this.config.loginForm) {
1882
- return this.fetchTokenByUP();
1883
- }
1884
- else {
1885
- return this.fetchTokenByCas();
1886
- }
1867
+ return this.fetchTokenByCas();
1887
1868
  }
1888
1869
  }
1889
1870
  fetchTokenByUP() {
@@ -1908,6 +1889,11 @@ class YunzaiAuthService {
1908
1889
  switch (response.errcode) {
1909
1890
  case 2000:
1910
1891
  const { access_token, expires_in, refresh_token, scope, token_type } = response.data;
1892
+ // 如果token不一致,清除缓存
1893
+ const token = this.tokenService.get()?.token;
1894
+ if (token && access_token && token !== access_token) {
1895
+ this.cacheService.clear();
1896
+ }
1911
1897
  return {
1912
1898
  token: access_token,
1913
1899
  expired: expires_in,