How to call a script without needing authentication on HTML5 Web Portal

Hello,

We need to make a custom API that will call a script on the HTML5 password portal.

The problem is that this API will be called prior to the user logging in to the portal. I have added the IApiProviderFor<QER.CompositionApi.Password.PasswordPortalApiProject> so the API is present in the password portal. 

When I call the custom API I get the error "Your session has expired. Please reload this page and login again.". So I tried using the  AllowUnauthenticated() but I still get denied. 

Is there a way to call the script or an event like this prior to logging in to the portal?

 

Use case for this:

The user will request a passcode that will be sent to his personal mobile phone. So that he can then enter the password portal via the requested passcode.

Thank you for your help,

Zan