title: apex APEX_CUSTOM_AUTH.LOGIN redirect
body: <p>I want to redirect the post login page to a change login page.
  I have a custom authentication schema which call user_mng.authenticate as authentication function. </p>
  
  <pre><code>function authenticate(p_username in VARCHAR2, p_password in VARCHAR2) RETURN BOOLEAN IS 
  ntype int;
        pwobf varchar2(100);
        BEGIN
          pwobf:=obfuscate(nvl(p_password,'**'));
          select user_role
          into ntype 
          from( select 1 user_role 
               from view_users
               where upper(user_id)=upper(p_username)
                and password=p_password
               union all
               select 2 user_role
               from view_users
               where upper(user_id)=upper(p_username)
                and password=pwobf);      
          apex_util.set_authentication_result(0);   
          RETURN TRUE;
        exception when no_data_found then
          apex_util.set_authentication_result(1);
          return false;
        END authenticate;
  </code></pre>
  
  <p>you can find below a printscreen of  the login page</p>
  
  <p><a href="http://gyazo.com/10dc90b9e271ae11fadfa48201665a3d.png" rel="nofollow">http://gyazo.com/10dc90b9e271ae11fadfa48201665a3d.png</a></p>
  
  <p>The login page is pretty much the one automatically created by APEX where in the post submit LOGIN process I have added</p>
  
  <pre><code>begin APEX_CUSTOM_AUTH.LOGIN (
      p_uname       =&gt; :P101_USERNAME,
      p_password    =&gt; :P101_PASSWORD,
      p_session_id  =&gt; V('APP_SESSION'),
      p_app_page    =&gt; :APP_ID||':18');end;
  </code></pre>
  
  <p>where page 18 is my target page while 1 is the home page.</p>
  
  <p>I don't know why, most of the time the page is sent to the home... I haven't be able to relate to any other condition but from time to time it goes to the change login page. If in the <code>p_app_page =&gt; :APP_ID||':18'</code> I set an invalid page a receive an error (the page is being read) as well if I set an invalid password (the auth. process is working) during the login.</p>
  
  <p>I've tried to clean browser cache... but it does not appear to have any effect.</p>
  
  <p>I'm using Apex 4.2.4 with Tomcat 7.
  I would deeply appreciate any help.</p>
  
  <p>Regards</p>