mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-01 16:33:07 +05:30
Demonstrate how to redirect
This commit is contained in:
parent
8131b71e26
commit
8e90033594
@ -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;
|
||||
|
||||
});
|
||||
~~~
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user