@@ -1037,24 +1037,24 @@ describe('OAuthProvider', () => {
1037
1037
// Return different props based on the grant type
1038
1038
if ( options . grantType === 'authorization_code' ) {
1039
1039
return {
1040
- tokenProps : {
1040
+ accessTokenProps : {
1041
1041
...options . props ,
1042
1042
tokenSpecific : true ,
1043
1043
tokenUpdatedAt : 'auth_code_flow'
1044
1044
} ,
1045
- grantProps : {
1045
+ newProps : {
1046
1046
...options . props ,
1047
1047
grantUpdated : true
1048
1048
}
1049
1049
} ;
1050
1050
} else if ( options . grantType === 'refresh_token' ) {
1051
1051
return {
1052
- tokenProps : {
1052
+ accessTokenProps : {
1053
1053
...options . props ,
1054
1054
tokenSpecific : true ,
1055
1055
tokenUpdatedAt : 'refresh_token_flow'
1056
1056
} ,
1057
- grantProps : {
1057
+ newProps : {
1058
1058
...options . props ,
1059
1059
grantUpdated : true ,
1060
1060
refreshCount : ( options . props . refreshCount || 0 ) + 1
@@ -1305,17 +1305,17 @@ describe('OAuthProvider', () => {
1305
1305
} ) ;
1306
1306
1307
1307
it ( 'should update token props during refresh when explicitly provided' , async ( ) => {
1308
- // Create a provider with a callback that returns both tokenProps and grantProps
1308
+ // Create a provider with a callback that returns both accessTokenProps and newProps
1309
1309
// but with different values for each
1310
1310
const differentPropsCallback = async ( options : any ) => {
1311
1311
if ( options . grantType === 'refresh_token' ) {
1312
1312
return {
1313
- tokenProps : {
1313
+ accessTokenProps : {
1314
1314
...options . props ,
1315
1315
refreshed : true ,
1316
1316
tokenOnly : true
1317
1317
} ,
1318
- grantProps : {
1318
+ newProps : {
1319
1319
...options . props ,
1320
1320
grantUpdated : true
1321
1321
}
@@ -1416,19 +1416,19 @@ describe('OAuthProvider', () => {
1416
1416
expect ( apiData . user ) . not . toHaveProperty ( 'grantUpdated' ) ;
1417
1417
} ) ;
1418
1418
1419
- it ( 'should handle callback that returns only tokenProps or only grantProps ' , async ( ) => {
1420
- // Create a provider with a callback that returns only tokenProps for auth code
1421
- // and only grantProps for refresh token
1422
- // Note: With the enhanced implementation, when only grantProps is returned
1423
- // without tokenProps , the token props will inherit from grantProps
1424
- const tokenPropsOnlyCallback = async ( options : any ) => {
1419
+ it ( 'should handle callback that returns only accessTokenProps or only newProps ' , async ( ) => {
1420
+ // Create a provider with a callback that returns only accessTokenProps for auth code
1421
+ // and only newProps for refresh token
1422
+ // Note: With the enhanced implementation, when only newProps is returned
1423
+ // without accessTokenProps , the token props will inherit from newProps
1424
+ const propsCallback = async ( options : any ) => {
1425
1425
if ( options . grantType === 'authorization_code' ) {
1426
1426
return {
1427
- tokenProps : { ...options . props , tokenOnly : true }
1427
+ accessTokenProps : { ...options . props , tokenOnly : true }
1428
1428
} ;
1429
1429
} else if ( options . grantType === 'refresh_token' ) {
1430
1430
return {
1431
- grantProps : { ...options . props , grantOnly : true }
1431
+ newProps : { ...options . props , grantOnly : true }
1432
1432
} ;
1433
1433
}
1434
1434
} ;
@@ -1441,7 +1441,7 @@ describe('OAuthProvider', () => {
1441
1441
tokenEndpoint : '/oauth/token' ,
1442
1442
clientRegistrationEndpoint : '/oauth/register' ,
1443
1443
scopesSupported : [ 'read' , 'write' ] ,
1444
- tokenExchangeCallback : tokenPropsOnlyCallback
1444
+ tokenExchangeCallback : propsCallback
1445
1445
} ) ;
1446
1446
1447
1447
// Create a client
@@ -1531,7 +1531,7 @@ describe('OAuthProvider', () => {
1531
1531
const api2Data = await api2Response . json ( ) ;
1532
1532
1533
1533
// With the enhanced implementation, the token props now inherit from grant props
1534
- // when only grantProps is returned but tokenProps is not specified
1534
+ // when only newProps is returned but accessTokenProps is not specified
1535
1535
expect ( api2Data . user ) . toEqual ( {
1536
1536
userId : "test-user-123" ,
1537
1537
username : "TestUser" ,
@@ -1622,7 +1622,7 @@ describe('OAuthProvider', () => {
1622
1622
it ( 'should correctly handle the previous refresh token when callback updates grant props' , async ( ) => {
1623
1623
// This test verifies fixes for two bugs:
1624
1624
// 1. previousRefreshTokenWrappedKey not being re-wrapped when grant props change
1625
- // 2. tokenProps not inheriting from grantProps when only grantProps is returned
1625
+ // 2. accessTokenProps not inheriting from newProps when only newProps is returned
1626
1626
let callCount = 0 ;
1627
1627
const propUpdatingCallback = async ( options : any ) => {
1628
1628
callCount ++ ;
@@ -1632,11 +1632,11 @@ describe('OAuthProvider', () => {
1632
1632
updatedCount : ( options . props . updatedCount || 0 ) + 1
1633
1633
} ;
1634
1634
1635
- // Only return grantProps to test that tokenProps will inherit from it
1635
+ // Only return newProps to test that accessTokenProps will inherit from it
1636
1636
return {
1637
- // Return new grant props to trigger the re-encryption with a new key
1638
- grantProps : updatedProps
1639
- // Intentionally not setting tokenProps to verify inheritance works
1637
+ // Return new props to trigger the re-encryption with a new key
1638
+ newProps : updatedProps
1639
+ // Intentionally not setting accessTokenProps to verify inheritance works
1640
1640
} ;
1641
1641
}
1642
1642
return undefined ;
0 commit comments