Skip to content

Commit

Permalink
feat: remove value field from token - OKTA-338251 (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuowu authored and aarongranick-okta committed Mar 10, 2021
1 parent efed197 commit c4eaa07
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 5.0.0

### Other

- [#515](https://github.com/okta/okta-auth-js/pull/515) Removes `token.value` field

## 4.7.2

### Bug Fixes
Expand Down
3 changes: 0 additions & 3 deletions lib/oidc/handleOAuthResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export function handleOAuthResponse(sdk: OktaAuth, tokenParams: TokenParams, res
if (accessToken) {
var accessJwt = sdk.token.decode(accessToken);
tokenDict.accessToken = {
value: accessToken,
accessToken: accessToken,
claims: accessJwt.payload,
expiresAt: Number(expiresIn) + Math.floor(Date.now() / 1000),
Expand All @@ -98,7 +97,6 @@ export function handleOAuthResponse(sdk: OktaAuth, tokenParams: TokenParams, res

if (refreshToken) {
tokenDict.refreshToken = {
value: refreshToken,
refreshToken: refreshToken,
expiresAt: Number(expiresIn) + Math.floor(Date.now() / 1000),
scopes: scopes,
Expand All @@ -112,7 +110,6 @@ export function handleOAuthResponse(sdk: OktaAuth, tokenParams: TokenParams, res
var idJwt = sdk.token.decode(idToken);

var idTokenObj: IDToken = {
value: idToken,
idToken: idToken,
claims: idJwt.payload,
expiresAt: idJwt.payload.exp,
Expand Down
1 change: 0 additions & 1 deletion lib/types/Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { UserClaims } from './UserClaims';

export interface AbstractToken {
expiresAt: number;
value: string;
authorizeUrl: string;
scopes: string[];
}
Expand Down
1 change: 0 additions & 1 deletion test/support/oauthUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ function validateResponse(res, expectedResp) {
expect(actual).toEqual(expected);
return;
}
expect(actual.value).toEqual(expected.value);
expect(actual.idToken).toEqual(expected.idToken);
expect(actual.claims).toEqual(expected.claims);
expect(actual.accessToken).toEqual(expected.accessToken);
Expand Down
6 changes: 0 additions & 6 deletions test/support/tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ tokens.standardIdTokenClaims = {
};

tokens.standardIdTokenParsed = {
value: tokens.standardIdToken,
idToken: tokens.standardIdToken,
claims: tokens.standardIdTokenClaims,
expiresAt: 1449699930,
Expand Down Expand Up @@ -108,7 +107,6 @@ tokens.standardIdToken2Claims = {
};

tokens.standardIdToken2Parsed = {
value: tokens.standardIdToken2,
idToken: tokens.standardIdToken2,
claims: tokens.standardIdToken2Claims,
expiresAt: 1449699930,
Expand Down Expand Up @@ -153,7 +151,6 @@ tokens.expiredBeforeIssuedIdTokenClaims = {
};

tokens.expiredBeforeIssuedIdTokenParsed = {
value: tokens.expiredBeforeIssuedIdToken,
idToken: tokens.expiredBeforeIssuedIdToken,
claims: tokens.expiredBeforeIssuedIdTokenClaims,
expiresAt: 1449690000,
Expand Down Expand Up @@ -191,7 +188,6 @@ tokens.authServerIdTokenClaims = {
};

tokens.authServerIdTokenParsed = {
value: tokens.authServerIdToken,
idToken: tokens.authServerIdToken,
claims: tokens.authServerIdTokenClaims,
expiresAt: 1449699930,
Expand Down Expand Up @@ -266,7 +262,6 @@ tokens.standardAccessTokenClaims = {
};

tokens.standardAccessTokenParsed = {
value: tokens.standardAccessToken,
accessToken: tokens.standardAccessToken,
claims: tokens.standardAccessTokenClaims,
expiresAt: 1449703529, // assuming time = 1449699929
Expand Down Expand Up @@ -306,7 +301,6 @@ tokens.authServerAccessTokenClaims = {
};

tokens.authServerAccessTokenParsed = {
value: tokens.authServerAccessToken,
accessToken: tokens.authServerAccessToken,
claims: tokens.authServerAccessTokenClaims,
expiresAt: 1449703529, // assuming time = 1449699929
Expand Down

0 comments on commit c4eaa07

Please sign in to comment.