Comments

miteshmap created an issue. See original summary.

miteshmap’s picture

Assigned: miteshmap » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.3 KB
miteshmap’s picture

Title: Leverage the user login_error_destination from social_auth » Leverage the use of login_error_destination from social_auth
gvso’s picture

Status: Needs review » Needs work
+++ b/src/Controller/FacebookAuthController.php
@@ -62,12 +63,22 @@ class FacebookAuthController extends OAuth2ControllerBase {
+    $redirect = 'user.login';
+    $redirect_param = [];
+
+    if ($error_dest = $this->dataHandler->get('login_error_destination')) {
+      $url = Url::fromUserInput($error_dest);
+      $redirect = $url->getRouteName();
+      $redirect_param = $url->getRouteParameters();
+      // Set current login_error_destination to null. so, it can be set again.
+      $this->dataHandler->set('login_error_destination', NULL);
+    }

Can we somehow include this logic in Social Auth itself? It would be applicable to all other modules as well.

miteshmap’s picture

we can add event dispatcher to social_auth module and user event subscriber here, but we need something in each social auth sub module, because each social site has different way to notify error.

Or on the second thought, we need event dispatcher in all social auth sub module and event subscriber in social_auth module, to handle the redirection part.

gvso’s picture

because each social site has different way to notify error.

In case of error, I think we can just call a function defined in Social Auth which takes care of dispatching the event and providing the error information. It is up to the event subscriber to handle the different errors that the implementers might throw. See my last comment in the related issue.

miteshmap’s picture

Status: Needs work » Needs review
StatusFileSize
new2.62 KB
miteshmap’s picture

StatusFileSize
new648 bytes
miteshmap’s picture

miteshmap’s picture

gvso’s picture

Title: Leverage the use of login_error_destination from social_auth » Dispatch authentication error event in callback
Version: 8.x-2.0-beta4 » 8.x-2.x-dev
gvso’s picture

Title: Dispatch authentication error event in callback » Dispatch failed authentication event in callback

  • gvso committed 730ad4e on 8.x-2.x
    Issue #3033751 by miteshmap: Dispatch failed authentication event in...
gvso’s picture

Status: Needs review » Fixed

I made some changes to make the code a bit simpler and pass the error to the event handler. Thank you! I hope this helps with your project!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.