@@ -184,40 +184,40 @@ |
||
184 | 184 | return; |
185 | 185 | } |
186 | 186 | switch ($_GET['response_type']) { |
187 | - case 'code': |
|
188 | - $Response->redirect( |
|
189 | - http_build_url( |
|
190 | - $redirect_uri, |
|
191 | - [ |
|
192 | - 'code' => $code, |
|
193 | - 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
194 | - ] |
|
195 | - ), |
|
196 | - 302 |
|
197 | - ); |
|
198 | - $Page->Content = ''; |
|
199 | - return; |
|
200 | - case 'token': |
|
201 | - $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri); |
|
202 | - if ($token_data) { |
|
203 | - unset($token_data['refresh_token']); |
|
204 | - $url = http_build_url( |
|
205 | - $redirect_uri, |
|
206 | - array_merge( |
|
207 | - $token_data, |
|
187 | + case 'code': |
|
188 | + $Response->redirect( |
|
189 | + http_build_url( |
|
190 | + $redirect_uri, |
|
208 | 191 | [ |
192 | + 'code' => $code, |
|
209 | 193 | 'state' => isset($_GET['state']) ? $_GET['state'] : false |
210 | 194 | ] |
211 | - ) |
|
195 | + ), |
|
196 | + 302 |
|
212 | 197 | ); |
213 | - $url = implode('#', explode('?', $url, 2)); |
|
214 | - $Response->redirect($url, 302); |
|
215 | 198 | $Page->Content = ''; |
216 | 199 | return; |
217 | - } else { |
|
218 | - error_redirect('server_error', "Server can't get token data, try later"); |
|
219 | - return; |
|
220 | - } |
|
221 | - default: |
|
222 | - error_redirect('unsupported_response_type', 'Specified response_type is not supported, only "token" or "code" types available'); |
|
200 | + case 'token': |
|
201 | + $token_data = $OAuth2->get_code($code, $client['id'], $client['secret'], $redirect_uri); |
|
202 | + if ($token_data) { |
|
203 | + unset($token_data['refresh_token']); |
|
204 | + $url = http_build_url( |
|
205 | + $redirect_uri, |
|
206 | + array_merge( |
|
207 | + $token_data, |
|
208 | + [ |
|
209 | + 'state' => isset($_GET['state']) ? $_GET['state'] : false |
|
210 | + ] |
|
211 | + ) |
|
212 | + ); |
|
213 | + $url = implode('#', explode('?', $url, 2)); |
|
214 | + $Response->redirect($url, 302); |
|
215 | + $Page->Content = ''; |
|
216 | + return; |
|
217 | + } else { |
|
218 | + error_redirect('server_error', "Server can't get token data, try later"); |
|
219 | + return; |
|
220 | + } |
|
221 | + default: |
|
222 | + error_redirect('unsupported_response_type', 'Specified response_type is not supported, only "token" or "code" types available'); |
|
223 | 223 | } |