Replies: 3 comments 8 replies
-
i tried to put the redirect url via shortcode like this /* setto il cookie con l'url della pagian attuale */ $url.= $_SERVER['REQUEST_URI']; $url.='dashboard'; echo do_shortcode( '[openid_connect_generic_login_button redirect_to="'.$url.'"]' ); but for some reason the redirection url is modified and brings me back to home, the flag 'Redirect Back to Origin Page' in the options is flagged, but if is'nt flagged the plugin redirect me in home. the atts in short code don't function ? |
Beta Was this translation helpful? Give feedback.
-
@Matteo182 so one thing I think you are running into is that the way the redirect functionality is working, or in some cases not working, is because it is relying on Cookies to manage this. I am faced with this issue on one of a clients sites, where the other 30+ sites all work fine, the redirect cookie is generated, but this one all of a sudden is not generating/setting the cookie. I will most likely be looking to change this functionality to no longer use a cookie but use the state of the OIDC login, which is generated on the WordPress site and handed back to WordPress after the IDP completes the authentication. This will mean needing to manage the state via most likely the database, or WordPress transients, but should address any issues that cause cookies from not getting set and preventing the redirection from working correctly. |
Beta Was this translation helpful? Give feedback.
-
Hi @timnolte , I found that it doesn't work fully with transients, because unfortunately I used the session id to distinguish the transients of one user from the other. However it seems that the session in production is not working due to the vpn. do you have another idea? how can i create different transient for each user? Or do you have an idea with which I can pass a different url redirect depending on the login page I am on? Hoping to hear from you soon thank you so much |
Beta Was this translation helpful? Give feedback.
-
I have the website where some pages are under VPN so not accessible even if you don't enter via VPN.
After login I used this hook: 'openid-connect-generic-redirect-user-back' and I hooked a function where if a user is of a certain type it takes him to a specific page. If, on the other hand, it is on a payment page I have to leave it on this page and then check the $redirect_url variable.
The thing works perfectly if I turn on the VPN from my PC, but if I turn off my VPN the function that I hooked to the hook does not work, or rather it is no longer called. So to be safe I put a log before the start of the hook in your plugin by checking the variable $redirect_url, which in normal situation is filled with the url of the page I am logging in from, but when the VPN is off this variable is empty.
Can you tell me what it can be caused by? why is the variable empty with the VPN off? and why doesn't this Hook work if I don't have a VPN?
thank you so much
this is the code that works with VPN on, it's quite simple so I don't think the problem is the code, also because it is not executed:
add_action( 'openid-connect-generic-redirect-user-back','keycloak_redirect_user_back', 10, 2 );
function keycloak_redirect_user_back( $redirect_url, $user ) {
$u = new mygUserModel( $user->ID );
Beta Was this translation helpful? Give feedback.
All reactions