Demonstrate how to redirect

This commit is contained in:
Alex Bilbie 2014-11-08 17:05:18 +00:00
parent 8131b71e26
commit 8e90033594

View File

@ -38,6 +38,12 @@ $router->get('/oauth', function (Request $request) use ($server) {
} catch (\Exception $e) {
if ($e->shouldRedirect()) {
return new Response('', 302, [
'Location' => $e->getRedirectUri()
]);
}
return new Response(
json_encode([
'error' => $e->errorType,
@ -51,12 +57,10 @@ $router->get('/oauth', function (Request $request) use ($server) {
// Everything is okay, save $authParams to the a session and redirect the user to sign-in
$response = new Response('', 302, [
return = new Response('', 302, [
'Location' => '/signin'
]);
return $response;
});
~~~