When you make your first application in APEX you typically have as default page 1 or the login page (101). If you want to change your default (first) page you need to have a look at three different places. Let's say we want to have page 9 as default page:
1) Application Builder > Your Application > Page 101 > Processes (Page Processing) > Login
Change Process to:
wwv_flow_custom_auth_std.login(Whenever somebody logs in we want him to go to page 9.
P_UNAME => :P101_USERNAME,
P_PASSWORD => :P101_PASSWORD,
P_SESSION_ID => v('APP_SESSION'),
P_FLOW_PAGE => :APP_ID||':9'
);
2) Shared Components > Security > Authentication Schemes > Your Authentication
Change the Logout URL: wwv_flow_custom_auth_std.logout?p_this_flow=&APP_ID.&p_next_flow_page_sess=&APP_ID.:9
If somebody logged out, we set the default page to 9 as that's our default page.
3) Shared Components > Security > Edit Security Attributes
Change the Home Link to: f?p=&APP_ID.:9:&SESSION.
If no page is specified this is the page to go to for ex. f?p=100 means we're going to application 100 with as default page, the page specified in the Home Link. You can also reference this url by #HOME_LINK#.
Thank you Dimitri for your answer.
ReplyDeleteBut i think that in the future should be much easier to change such properties. Just a parameter at the application level!
Best regards
Adrian
Thanks, you're the man.
ReplyDeleteYou've saved me from a major headache, a simple thanks won't suffice but that's all i can say.
ReplyDeleteThanks again.
I was VERY happy to find this - I agree this should either be made MUCH simpler to do by ApEx, or, even better, be a user choice when creating an application.
ReplyDeleteI have one question, though: I did all three changes, and it works fine. What does NOT work is, if I export the app, and import it with a different ID as run-only (for deployment.) In that case, the logout process STILL uses :app_id:1 (and not :10 like I changed it to.)
Any ideas?
(Thanks still for a clear explanation!)
Thanks a lot for this post, it was really helpfull
ReplyDeletethanks, most helpfull
ReplyDeleteHi,
ReplyDeleteMaking the changes as you said will take me to a specific page. But if i want to send user to different pages how can I do that.
e.g if user is dummy he should go to page 3 and if user is abc he should go to page 1.
How can I achieve this?
please respond as soon as possible.
Thanks in advance.
Thanks for this complete and compact Tip!
ReplyDeleteKind Regards, Frank
Thank you.
ReplyDeleteWorked perfect. thanks
ReplyDeleteHi Dimitri,
ReplyDeleteI am facing issue on setting up default page even I have checked my all 3 settings which you have described in this post.
My default page should be 7 but sometimes users are redirecting to page 1.
Please suggest.
Regards,
Jack
my apex homepage is not working after i run forms builder and forms application. could you please give solution for this.
ReplyDeleteThanks in advance.
Thanks for this. I'm having a problem though that if someone tries to log in and fail page security, if they press ok and log in with a user who passes page security Apex tries to take them to page 1 (ignoring my settings of page 2). Do you know how to stop this. Thanks
ReplyDeleteActually as soon as I posted my comment I realised the page direction was been set by the login page (call to wwv_flow_custom_auth_std.login, p_flow_page)
ReplyDeleteI agree with your with.Thanks you share with me this nice post.Keep it up...
ReplyDeleteMy requirement has slight change where different users type should be directed to different pages. So
ReplyDeleteI wrote like this :
-------------------
DECLARE
l_routeto number;
l_errordesc varchar2(4000);
lc_clob CLOB;
LN_COUNT NUMBER;
BEGIN
IF upper(trim(:P101_USERNAME)) = 'ABC' THEN
l_routeto := 1;
elsif upper(trim(:P101_USERNAME)) = 'DEF' THEN
l_routeto := 201;
elsif upper(trim(:P101_USERNAME)) = 'HIJ' THEN
l_routeto := 301;
else
l_routeto := 1;
END IF;
wwv_flow_custom_auth_std.login
(
P_UNAME => :P101_USERNAME,
P_PASSWORD => :P101_PASSWORD,
P_SESSION_ID => v('APP_SESSION'),
P_FLOW_PAGE => :APP_ID||':'||l_routeto
);
exception
when others then
NULL;
END;
I was able to land into respective pages allocated to Username 'ABC ' and ' DEF ' but got an error when i try to login with username 'HIJ'.
Please help me out.
Thanks & Regards,
Vikram S
What error did you get? Maybe the page didn't exist or has an authorization on?
ReplyDeleteDimitri,
ReplyDeleteI just started in APEX. I have a requirement to add a change password page so that the user can change his/her password if it is expired or if they just want to. I had added a button to the login page and on the login page process had it go to my new change password page. However, it makes the user login first. I don't want the user to have to login. The only way this currently works is that they select the change password button -> login and it does take them to the change password page. I would like to have them push the change password button and have it go directly to the page without having them login. Any ideas? Thanks. Beverly Selby
Hi Beverly,
ReplyDeleteYou need to set your page as Public (in security section of your Page attributes).
That way for the reset password page they don't need to login.
Hope that helps,
Dimitri
Bare with me here.... I am using the Authentication Scheme using Application Express Authentication. 101 is my login page ... 36 is my change password page. I edited page 36 set the Security -> Authentication = "Page is Public". I click on the Change Password button and it does go to the change password page however when I put in the username = '', Old password = '', New password and confirm password it comes back with Invalid Old Password. I am typing in the correct password for the Old password. For the Old Password field -> Source, Source Used = Always, replacing any existing value in session state, Source, Source Type = Database Column, Source value or expression = 'PASSWORD'. Once I changed the page to public it put "NOBODY" in the User Name field on the change password field. So when I type in an APEX user and the old password new password, confirm the password...it always indicates that the old password is invalid.
ReplyDeleteI want users that have not yet changed their standard password to be forced to change it the first time they login. This seems to work fine when the first page they visit is the Login Page (I have added a brank to a Change password page with the condition that looks at the used password and compares this to the standard password). But I also want this same functionality to work when the user selects a url that point to another page (not the login page). As they cannot use that page whitout logging in, the users is first forced to go to the login page. In those situations, the branching in the login page to the Changes Password page is skipped and after logging in the users sees the page the expected. But in those cases the users has not yet changed the standard password.
ReplyDeleteI just cannot get this to work. Any suggestions?
You can have an application process always being fired that checks if they need to change their password.
ReplyDeleteIf so, you redirect them to the password change page.
Or you could do that with a post_login procedure in your authentication.
I have tried both but unfortunately still have not got it to work. The application process does not seem to work whith a Process Point of 'After Authentication'. Changing this to 'On Load: Before Body' does seem to work, but the code to redirect to the change password page throws an error. I am using the htp.init; owa_util.redirect_url procedure to navigate to the change password page.
ReplyDeleteI have the same problem with the post_login procedure. Redirecting using the owa_util.redirect_url does not seem to work.
What am I doing wrong?
Hi Geert,
ReplyDeleteWhat version of APEX are you using?
Thanks,
Dimitri
We are at version 5.1.0.00.45.
ReplyDeleteI have solved my problem by manipulating the FSP_AFTER_LOGIN_URL (session item?).
It not a very elegant solution, but is seems to work.
Thank you for help!
In Oracle apex. If i open 2nd page it is opening fine. again i open 6th page near to that tab by using URL. I am navigating to Home page
ReplyDeleteAs i wanted those two pages to linked to other application it is difficult to make it further. Could you suggest me on this
Hi Geert,
ReplyDeleteIn version 20.1 the code behind apex_authentication.login() no longer seems to have the additional 2 parameters to specify.
What is the way to do this in that version?
thanks
Ronny
Ronny Eelen
Hi again,
ReplyDeleteI already found I need to use this
wwv_flow_custom_auth_std.login(
p_uname => :P9999_USERNAME,
p_password => :P9999_PASSWORD,
p_session_id => v('APP_SESSION'),
p_flow_page => :APP_ID||':2'
);
Page 2 is the page I want to end up on.
But it doesn't happen. There is no error, just it lands on the home page I guess.
Is there anything els e I can look at?
thanks
Ronny
Called you Geert... should have been Dimitri
ReplyDeleteMy apologies.
Hi All,
ReplyDeletei Wrote like this on Login page-> login Process
but unable to redirect to reference page.
I wrote like this :
-------------------
DECLARE
l_routeto number;
l_errordesc varchar2(4000);
lc_clob CLOB;
LN_COUNT NUMBER;
BEGIN
IF upper(trim(:P101_USERNAME)) = 'ABC' THEN
l_routeto := 1;
elsif upper(trim(:P101_USERNAME)) = 'DEF' THEN
l_routeto := 201;
elsif upper(trim(:P101_USERNAME)) = 'HIJ' THEN
l_routeto := 301;
else
l_routeto := 1;
END IF;
wwv_flow_custom_auth_std.login
(
P_UNAME => :P101_USERNAME,
P_PASSWORD => :P101_PASSWORD,
P_SESSION_ID => v('APP_SESSION'),
P_FLOW_PAGE => :APP_ID||':'||l_routeto
);
exception
when others then
NULL;
END;
Please Help...