diff --git a/auth-server-auth-code.md b/auth-server-auth-code.md index 0667c86b..438ae0f9 100755 --- a/auth-server-auth-code.md +++ b/auth-server-auth-code.md @@ -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; - }); ~~~