@@ -93,22 +93,17 @@ public function executeRequest($inputs, $parsedCookie) {
93
93
private function tryRefreshToken ($ inputs , $ parsedCookie ) {
94
94
$ this ->callMode = ProxyAux::MODE_REFRESH ;
95
95
96
- //TODO: remove and save additional params
97
-
98
96
//Get a new access token from refresh token
99
97
$ inputs = $ this ->removeTokenExtraParams ($ inputs );
100
- $ inputs = $ this ->addRefreshExtraParams ($ inputs , $ parsedCookie );
101
- $ proxyResponse = $ this ->replicateRequest ($ parsedCookie [ProxyAux::COOKIE_METHOD ], $ parsedCookie [ProxyAux::COOKIE_URI ], $ inputs );
98
+ $ params = $ this ->addRefreshExtraParams (array () , $ parsedCookie );
99
+ $ proxyResponse = $ this ->replicateRequest ($ parsedCookie [ProxyAux::COOKIE_METHOD ], $ parsedCookie [ProxyAux::COOKIE_URI ], $ params );
102
100
103
101
$ content = $ proxyResponse ->getContent ();
104
102
if ($ proxyResponse ->getStatusCode () === 200 && array_key_exists (ProxyAux::ACCESS_TOKEN , $ content )) {
105
103
$ this ->callMode = ProxyAux::MODE_TOKEN ;
106
104
$ parsedCookie [ProxyAux::ACCESS_TOKEN ] = $ content [ProxyAux::ACCESS_TOKEN ];
107
105
$ parsedCookie [ProxyAux::REFRESH_TOKEN ] = $ content [ProxyAux::REFRESH_TOKEN ];
108
106
109
- //TODO: add additional saved params
110
-
111
- $ inputs = $ this ->removeRefreshTokenExtraParams ($ inputs );
112
107
$ inputs = $ this ->addTokenExtraParams ($ inputs , $ parsedCookie );
113
108
$ proxyResponse = $ this ->replicateRequest ($ this ->method , $ this ->uri , $ inputs );
114
109
@@ -133,7 +128,7 @@ private function tryRefreshToken($inputs, $parsedCookie) {
133
128
*/
134
129
private function replicateRequest ($ method , $ uri , $ inputs ) {
135
130
$ guzzleResponse = $ this ->sendGuzzleRequest ($ method , $ uri , $ inputs );
136
- $ proxyResponse = new ProxyResponse (null , $ guzzleResponse ->getStatusCode (), $ guzzleResponse ->getReasonPhrase (), $ guzzleResponse ->getProtocolVersion (), $ this ->getResponseContent ($ guzzleResponse ));
131
+ $ proxyResponse = new ProxyResponse ($ guzzleResponse ->getStatusCode (), $ guzzleResponse ->getReasonPhrase (), $ guzzleResponse ->getProtocolVersion (), $ this ->getResponseContent ($ guzzleResponse ));
137
132
138
133
return $ proxyResponse ;
139
134
}
@@ -276,17 +271,4 @@ private function removeTokenExtraParams($inputs) {
276
271
return $ inputs ;
277
272
}
278
273
279
- /**
280
- * @param $inputs
281
- * @return array
282
- */
283
- private function removeRefreshTokenExtraParams ($ inputs ) {
284
- $ inputs = ProxyAux::removeQueryValue ($ inputs , ProxyAux::GRANT_TYPE );
285
- $ inputs = ProxyAux::removeQueryValue ($ inputs , ProxyAux::REFRESH_TOKEN );
286
- $ inputs = ProxyAux::removeQueryValue ($ inputs , ProxyAux::CLIENT_ID );
287
- $ inputs = ProxyAux::removeQueryValue ($ inputs , ProxyAux::CLIENT_SECRET );
288
-
289
- return $ inputs ;
290
- }
291
-
292
274
}
0 commit comments