Return authenticated value in workers

I would really like to be able to pull in to our logs (via workers) a value to show if the current user is an authenticated user so we can write alerts against it, however I cant see how to achieve this.

I think we should be able to use the .net cookie .ASPXFORMSAUTH, which is set from the application (before it hits the server) and is only present when a user is logged in. There is nothing in the request though that shows this, so I was hoping that someone could point me in the direction of how to add this into it…

Thank you to anyone in advance if you can help me out of this little hole!

Try something like this:

const name = 'ASPXFORMSAUTH';
const cookie = event.request.headers.get('Cookie')
var user_status = 'out';
if (cookie && cookie.includes(name)){
    user_status =  'in';
1 Like

Absolutely nailed it. Cheers @adaptive :ok_hand:

1 Like