diff --git a/config/routes.php b/config/routes.php index f5a7e45b..2f903922 100644 --- a/config/routes.php +++ b/config/routes.php @@ -15,9 +15,9 @@ $route->post('/login', 'AuthController@postLogin'); $route->get('/logout', 'AuthController@logout'); // OAuth -$route->get('/oauth/{provider:\w+}', 'OAuthController@index'); -$route->post('/oauth/{provider:\w+}/connect', 'OAuthController@connect'); -$route->post('/oauth/{provider:\w+}/disconnect', 'OAuthController@disconnect'); +$route->get('/oauth/{provider}', 'OAuthController@index'); +$route->post('/oauth/{provider}/connect', 'OAuthController@connect'); +$route->post('/oauth/{provider}/disconnect', 'OAuthController@disconnect'); // User settings $route->get('/settings/password', 'SettingsController@password'); diff --git a/src/Controllers/OAuthController.php b/src/Controllers/OAuthController.php index 858d1f52..5a0db7c4 100644 --- a/src/Controllers/OAuthController.php +++ b/src/Controllers/OAuthController.php @@ -113,12 +113,14 @@ class OAuthController extends BaseController ] ); } catch (IdentityProviderException $e) { + $response = $e->getResponseBody(); + $response = is_array($response) ? json_encode($response) : $response; $this->log->error( '{provider} identity provider error: {error} {description}', [ 'provider' => $providerName, 'error' => $e->getMessage(), - 'description' => $e->getResponseBody()['error_description'] ?: '', + 'description' => $response, ] ); @@ -297,6 +299,10 @@ class OAuthController extends BaseController throw new HttpNotFound('oauth.not-found'); } + $config = array_merge( + ['username' => null, 'email' => null, 'first_name' => null, 'last_name' => null], + $config + ); $this->session->set( 'form_data', [