Impersonated call of REST API from post function script

I have a scriptrunner post funcion script belongs to a transition inside a workflow. I should call worklog REST-API function to create a new worklog on behalf of not the initiating user. Because the domain of the caller users is fairly big, generating and using their user API tokens looks extremely cumbersome. Is impersonation described in this link possible from scriptrunner script? I’m lost how to import jwt module, how to get oauthClientId and key.