File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -759,7 +759,6 @@ Service_.prototype.ensureExpiresAtSet_ = function(token) {
759759Service_ . prototype . refresh = function ( ) {
760760 validate_ ( {
761761 'Client ID' : this . clientId_ ,
762- 'Client Secret' : this . clientSecret_ ,
763762 'Token URL' : this . tokenUrl_
764763 } ) ;
765764
Original file line number Diff line number Diff line change @@ -666,7 +666,6 @@ Service_.prototype.ensureExpiresAtSet_ = function(token) {
666666Service_ . prototype . refresh = function ( ) {
667667 validate_ ( {
668668 'Client ID' : this . clientId_ ,
669- 'Client Secret' : this . clientSecret_ ,
670669 'Token URL' : this . tokenUrl_
671670 } ) ;
672671
Original file line number Diff line number Diff line change @@ -387,6 +387,31 @@ describe('Service', () => {
387387 done ( ) ;
388388 } ) ;
389389
390+ it ( 'should refresh token granted for PKCE' , ( done ) => {
391+ var token = {
392+ granted_time : 100 ,
393+ expires_in : 0 ,
394+ refresh_token : 'bar'
395+ } ;
396+ var properties = new MockProperties ( {
397+ 'oauth2.test' : JSON . stringify ( token )
398+ } ) ;
399+
400+ mocks . UrlFetchApp . resultFunction = ( ) => JSON . stringify ( {
401+ access_token : Math . random ( ) . toString ( 36 )
402+ } ) ;
403+
404+ OAuth2 . createService ( 'test' )
405+ . setClientId ( 'test' )
406+ . setTokenUrl ( 'http://www.example.com' )
407+ . setPropertyStore ( properties )
408+ . refresh ( ) ;
409+
410+ var storedToken = JSON . parse ( properties . getProperty ( 'oauth2.test' ) ) ;
411+ assert . equal ( storedToken . refresh_token , 'bar' ) ;
412+ done ( ) ;
413+ } ) ;
414+
390415 it ( 'should retain refresh expiry' , ( ) => {
391416 const NOW_SECONDS = OAuth2 . getTimeInSeconds_ ( new Date ( ) ) ;
392417 const ONE_HOUR_AGO_SECONDS = NOW_SECONDS - 360 ;
You can’t perform that action at this time.
0 commit comments