HowTo Include Server-Side Script into Account Management

Hi,

Really great to use Keycloak, I am using it for SSO for multiple services.
I am using LDAP in the background and I enhanced the registration and account page to have things like phone number in it.
Now I want to have like a toggle so people can subscribe to an internal newsletter.
The script would use an API via curl to update the users email.

Problem, how do I protect the API token, if in the theme I can only use javascript? I don’t know how to include curl in FTL.
I thought about creating a complete new account management page, but thats a lot of work, for just a small toggle and so.

Any idea how to achieve this, would be great, thanks in advance :slight_smile:

More detailed I want to achieve the following:
When the user changes his email, a call to the API is made, changing the email and telling the API to send a verification email (as right now Keycloak doesn’t verify the email, before changing it, the pull request is not through).
And it should be a toggle there, to enable or disable the subscription, with the help of API calls and if statements to know if the users email subscribed (making the toggle of) or on when his email was found.