thanks for the explanation. You are right, APEX deletes the session before branching to the Post-Logout URL. I thought that we loaded session state into PL/SQL before deleting the session, but apparently that's not the case. It makes sense to be able to use substitution variables in the Post-Logout URL, so you can define a URL like "&G_LOGOUT_URL." that is based on an application item. I could also reproduce the error in wwv_flow_custom_auth_std.logout.
One way to work around this problem for now is
- create a new page "logout"
- add a before header process that executes
begin apex_authentication.logout ( p_session_id => :SESSION, p_app_id => :APP_ID ); exception when apex_application.e_stop_apex_engine then null; end; apex_debug.trace('redirecting to %s', :G_LOGOUT_URL); sys.owa_util.redirect_url(:G_LOGOUT_URL); apex_application.stop_apex_engine;
- redirect to that page to log the user out (e.g. by placing f?p=&APP_ID.:102:&SESSION. in the "Logout" navigation bar entry)
I tried it but it did not work. It redirects to the application's own login page.
The manual states that APEX_AUTHENTICATION.LOGOUT "closes the session and redirects to the application's home page". This would, in turn, redirect to the login page.
I moved APEX_APPLICATION.STOP_APEX_ENGINE; before APEX_AUTHENTICATION.LOGOUT and it appears to work but I don't know if it really does.
if you move APEX_APPLICATION.STOP_APEX_ENGINE, it raises an exception and the session logout does not happen, so I would not do that. Instead, can you please try again with a post-logout URL of null in the authentication scheme? In my test case, I used &G_LOGOUT_URL., but since the substitution value is empty in 4.2.3, the effective value is null. Btw, I filed bug #17555033 for this issue and already fixed it in 5.0.
I have problem with "wwv_flow_custom_auth_std.logout" called from a logout from menu bar entry wich is defined, as in your suggestion as:
In runtime it value becomes like:
This sent me to page 33 on logout process.
On page 33, in on load before header, I have code which reset many variables:
:P33_SESSION_TIMEOUT := XE_GLOBAL_PKG.get_app_def_session_timeout;
:G_SESS_DATE_FORMAT := 'DD.MM.YYYY';
:G_SESS_DATE_TIME_FORMAT := 'DD.MM.YYYY HH24:MI:SS';
SELECT to_char(sysdate, :G_SESS_DATE_TIME_FORMAT) INTO :G_DATE_TIME FROM DUAL;
when others then
auto_log_error_apex_web_app ('Process "Reset and init vars"- When others');
It works for several years without any problem (from Apex 3.x if I remember good). Now in 4.2.3 I have Apex_listener error and could not help.
So mine question is:
Does your answer means that in Apex 5.0 this all will work again as it was in 4.2 or code modification should be done anyway? I'd like o stay on this code because it was tested in many case and works OK.
If previous answer is that Apex 5.0 will not fix that (to be OK as before) could you please tell me a little bit more widely what to do...haven't understand from your previous post.
apex_authentication.logout is the only logout procedure that we will support in the future. We had to deprecate the others, see here:
The wwv_flow_custom_auth_std.logout procedure first deletes the session. Then it redirects to page 33. This request creates a new session, where your before header process initializes these variables. Not sure if that is what you expect the code to do, but that's what it does in 4.x and probably also in 3.x. What Apex Listener error do you get?
The best way to execute code after logout is the post logout procedure hook in custom authentication schemes or authentication plugins. Please explain what you intend to do on logout and we can discuss how to accomplish this. Maybe you should also start a new forum thread, since this one is already answered and people will therefore skip the ongoing discussion.