File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -364,19 +364,20 @@ open class OAuth2: OAuth2Base {
364364
365365 perform ( request: post) { response in
366366 do {
367- let data = try response. responseData ( )
368- let json = try self . parseRefreshTokenResponseData ( data)
369367 let statusCode = response. response. statusCode
370368 switch statusCode {
371369 case 400 ..< 500 :
372370 throw OAuth2Error . clientErrorWithStatus ( statusCode)
373371 case 500 ... 599 :
374372 throw OAuth2Error . serverErrorWithStatus ( statusCode)
373+ case 200 ..< 300 :
374+ let data = try response. responseData ( )
375+ let json = try self . parseRefreshTokenResponseData ( data)
376+ self . logger? . debug ( " OAuth2 " , msg: " Did use refresh token for access token [ \( nil != self . clientConfig. accessToken) ] " )
377+ callback ( json, nil )
375378 default :
376379 throw OAuth2Error . generic ( " Failed with status \( response. response. statusCode) " )
377380 }
378- self . logger? . debug ( " OAuth2 " , msg: " Did use refresh token for access token [ \( nil != self . clientConfig. accessToken) ] " )
379- callback ( json, nil )
380381 }
381382 catch let error {
382383 self . logger? . debug ( " OAuth2 " , msg: " Error refreshing access token: \( error) " )
You can’t perform that action at this time.
0 commit comments