Yesterday I was creating a “remember me” functionality in an APEX authentication scheme. Fairly simple:
- add a “remember me” checkbox-item on the login page
- create a custom login procedure that
- sets a cookie
- calls the apex_authentication.login procedure
- Create an auto-login procedure “before headers” that reads the cookie and if everything ok logs in the user.
output_cookie writes the cookie using:
Fairly simple code is it not?
But whatever I tried: removing logging-lines, setting html-headers etc., etc. my cookie was not written:
In the end it was a simple thing. Since APEX 5.1 the page does not “SUBMIT” by default, but instead does this “Only for succes”.
Here the browser will do kind of an AJAX call, interprets the result from validations and the “on submit” processes and will act accordingly.
It is therefore essential that when writing cookies you always use the “Always” setting at page level, as displayed in the image above.