From b00271f4980317bd740e00b9b3013f98d160a7e8 Mon Sep 17 00:00:00 2001 From: Shuo Wu Date: Thu, 29 Oct 2020 11:08:41 -0400 Subject: [PATCH] feat: remove value field from token - OKTA-338251 (#515) --- CHANGELOG.md | 1 + lib/token.ts | 2 -- lib/types/Token.ts | 1 - test/support/oauthUtil.js | 1 - test/support/tokens.js | 6 ------ 5 files changed, 1 insertion(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8899e1f61..feac96ab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - [#469](https://github.com/okta/okta-auth-js/pull/469) Adds "rate limiting" logic to token autoRenew process to prevent too many requests be sent out which may cause application rate limit issue. - [#503](https://github.com/okta/okta-auth-js/pull/503) Supports relative uri for [options.redirectUri](README.md#additional-options) - [#478](https://github.com/okta/okta-auth-js/pull/478) Adds cross tabs communication to sync `AuthState`. +- [#515](https://github.com/okta/okta-auth-js/pull/515) Removes `token.value` field ### Bug Fixes diff --git a/lib/token.ts b/lib/token.ts index 68e81b4d0..0b462e1a6 100644 --- a/lib/token.ts +++ b/lib/token.ts @@ -262,7 +262,6 @@ function handleOAuthResponse(sdk: OktaAuth, tokenParams: TokenParams, res: OAuth if (accessToken) { tokenDict.accessToken = { - value: accessToken, accessToken: accessToken, expiresAt: Number(expiresIn) + Math.floor(Date.now()/1000), tokenType: tokenType, @@ -276,7 +275,6 @@ function handleOAuthResponse(sdk: OktaAuth, tokenParams: TokenParams, res: OAuth var jwt = sdk.token.decode(idToken); var idTokenObj: IDToken = { - value: idToken, idToken: idToken, claims: jwt.payload, expiresAt: jwt.payload.exp, diff --git a/lib/types/Token.ts b/lib/types/Token.ts index 937a59997..c7aab58e3 100644 --- a/lib/types/Token.ts +++ b/lib/types/Token.ts @@ -14,7 +14,6 @@ import { UserClaims } from './UserClaims'; export interface AbstractToken { expiresAt: number; - value: string; authorizeUrl: string; scopes: string[]; } diff --git a/test/support/oauthUtil.js b/test/support/oauthUtil.js index 5837144be..fa4d00034 100644 --- a/test/support/oauthUtil.js +++ b/test/support/oauthUtil.js @@ -112,7 +112,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); diff --git a/test/support/tokens.js b/test/support/tokens.js index 87f19bd44..36f3de260 100644 --- a/test/support/tokens.js +++ b/test/support/tokens.js @@ -60,7 +60,6 @@ tokens.standardIdTokenClaims = { }; tokens.standardIdTokenParsed = { - value: tokens.standardIdToken, idToken: tokens.standardIdToken, claims: tokens.standardIdTokenClaims, expiresAt: 1449699930, @@ -106,7 +105,6 @@ tokens.standardIdToken2Claims = { }; tokens.standardIdToken2Parsed = { - value: tokens.standardIdToken2, idToken: tokens.standardIdToken2, claims: tokens.standardIdToken2Claims, expiresAt: 1449699930, @@ -151,7 +149,6 @@ tokens.expiredBeforeIssuedIdTokenClaims = { }; tokens.expiredBeforeIssuedIdTokenParsed = { - value: tokens.expiredBeforeIssuedIdToken, idToken: tokens.expiredBeforeIssuedIdToken, claims: tokens.expiredBeforeIssuedIdTokenClaims, expiresAt: 1449690000, @@ -189,7 +186,6 @@ tokens.authServerIdTokenClaims = { }; tokens.authServerIdTokenParsed = { - value: tokens.authServerIdToken, idToken: tokens.authServerIdToken, claims: tokens.authServerIdTokenClaims, expiresAt: 1449699930, @@ -248,7 +244,6 @@ tokens.standardAccessToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXIiOj' + 'EQ9-Ua9rPOMaO0pFC6h2lfB_HfzGifXATKsN-wLdxk6cgA'; tokens.standardAccessTokenParsed = { - value: tokens.standardAccessToken, accessToken: tokens.standardAccessToken, expiresAt: 1449703529, // assuming time = 1449699929 scopes: ['openid', 'email'], @@ -271,7 +266,6 @@ tokens.authServerAccessToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXIiOjE 'h9gY9Z3xd92ac407ZIOHkabLvZ0-45ANM3Gm0LC0c'; tokens.authServerAccessTokenParsed = { - value: tokens.authServerAccessToken, accessToken: tokens.authServerAccessToken, expiresAt: 1449703529, // assuming time = 1449699929 scopes: ['openid', 'email'],