Call JavaScript function by pressing button

Do you need that value on the server at all?

That webAuthnRegisterRequest parameter

Or is it just something you need to pass to the register call in the browser?

I need it to pass the register call in the browser.

Define it in the window object in the JavaScript side and then you can refer to it in the JavaScript string

so in JS, something like this: window.warRequest = webAuthnRegisterRequest
and in Java: UI.getCurrent().getPage().executeJs("register(window.warRequest")

    
    window.register = function(webAuthnRegisterRequest) {

        //some code
        //completely irrelevant

        }

That’s halfway there

You’re adding the register function to the window. Now add the parameter you’re supposed to be calling the function with in window as well.

    
    window.register = function(webAuthnRegisterRequest) {
    window.webAuthn = webAuthnRegisterRequest

        //some code
        //completely irrelevant

        }

You have the first two lines the wrong way around

The 2nd line should be the first one?

yes

I’m assuming that variable is known to the JavaScript somehow

But where will the fetched data then be printed out?

I don’t really understand that question

A token should be created on a privacyIDEA server. For this an authentication process needs to be performed. To achieve this goal, I need data.

where are you fetching the token?

https://privacvyidea-server.com/token/init

To fetch the data, I need to send POST request to the API endpoint /token/init.