Skip to content

Commit

Permalink
fix(oauth2-core) 修复 tokenResponse 转换错误 (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
lccf authored Sep 23, 2023
1 parent 6ca0f24 commit bd98f1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change

## 2.49.5

- fix(oauth2-core) 修复 tokenResponse 转换错误

## 2.49.4

- fix(cli) 移除 monorepo 中的 nx 依赖,降低对 node 版本的要求
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ export class AccessTokenResponseConverter {
const scopes = this.getScopes(tokenResponse);
const refreshToken = tokenResponse[OAuth2ParameterNames.REFRESH_TOKEN];

const checkParameters = [
OAuth2ParameterNames.ACCESS_TOKEN,
OAuth2ParameterNames.EXPIRES_IN,
OAuth2ParameterNames.REFRESH_TOKEN,
OAuth2ParameterNames.SCOPE,
OAuth2ParameterNames.TOKEN_TYPE
];
const additionalParameters: { [key: string]: string } = {};
for (const key in tokenResponse) {
if (Object.prototype.hasOwnProperty.call(tokenResponse, key)) {
if ([OAuth2ParameterNames.ACCESS_TOKEN, OAuth2ParameterNames.EXPIRES_IN,
OAuth2ParameterNames.REFRESH_TOKEN, OAuth2ParameterNames.SCOPE, OAuth2ParameterNames.TOKEN_TYPE].indexOf(key) !== -1) {
additionalParameters[key] = tokenResponse[key];
}
if (Object.prototype.hasOwnProperty.call(tokenResponse, key) && !checkParameters.includes(key)) {
additionalParameters[key] = tokenResponse[key];
}
}

Expand Down

0 comments on commit bd98f1e

Please sign in to comment.