Support » Plugin: Simple Google Connect » How to get 'redirect_to' working with SSO?

  • Hi Otto,

    After login in with SGC’s SSO, users get redirected to the dashboard. Normally, apart from being a bit of a detour sometimes, this is not a real problem. But when using SGC’s SSO on a site that needs users to log in before continuing to read some content, the dashboard redirect gets these readers lost and they have trouble finding back the page where they left off. So…

    Wanting to get SGC to redirect to the redirect_to URI instead of the dashboard after login, I tried to pass redirect_to as an additional $args array value in function sgc_oauth_request_link() (sgc-base.php) just before http_build_query($args) is called. This works as I see the &redirect_to=... in the login buttons href on the login screen. And after clicking the button, I can still find it inside the URL used for the login screen.

    But as far as I can tell, the request parameter gets dropped somewhere along the line after login it at google and coming back and passing through function sgc_oauth_catcher() where I would have liked to be able to pass it on again to function sgc_login_user_popup_handler() (sgc-login.php) to replace the line

    $redirect = admin_url();

    with something like

    $redirect = (isset($oauth['redirect_to'])) ? $oauth['redirect_to'] : admin_url();

    to finally redirect to the ‘correct’ location.

    Would this approach be feasible at all? If so, would you be able to tell me where the parameter got dropped and where/how to pass it along so it reaches the end of the trail?

    If not, maybe passing it via a cookie would be a better/easier alternative?

    Thanks for any thoughts on this 🙂

    Cheers, Allard

  • The topic ‘How to get 'redirect_to' working with SSO?’ is closed to new replies.