Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

setting cookie in custom authentication scheme

rjw8888Dec 7 2021

Hey all - apologies if this has already been asked, but there isn't a good way to search the new forums. In short, I'm trying to set a cookie in a custom authentication scheme, but the cookie isn't getting set.

My custom authentication scheme has one setting:
Authentication Function Name = test_login

And test_login is:
create or replace function test_login(p_username in varchar2, p_password in varchar2) return boolean is
begin
if lower(p_username) = 'test' then
htp.init;
owa_util.mime_header('text/html', FALSE);
owa_cookie.send(
name => 'APEX_JWT',
value => 'test',
expires => sysdate+1,
path => '/',
domain => NULL,
secure => NULL,
httponly => 'Y');
return true;
else
htp.init;
owa_util.mime_header('text/html', FALSE);
owa_cookie.send(
name => 'APEX_JWT',
value => null,
expires => sysdate-1,
path => '/',
domain => NULL,
secure => NULL,
httponly => 'Y');
return false;
end if;
end;
/

So if I login with username = 'test,' the cookie should be set, otherwise it should be cleared. The cookie is never set.

Any idea what I'm doing wrong? I'm basing this off of https://blogs.oracle.com/oraclemagazine/post/creating-custom-authentication

Thanks
Rob

This post has been answered by rjw8888 on Dec 7 2021
Jump to Answer
Comments
Post Details
Added on Dec 7 2021
2 comments
963 views