I have also found the solution you linked. I have tried it but it seems the script (rules) only work for Authorization Core.
I wonder how to add those rules for the Authorization Extension?
Yes, you should be able to call the authorization extension API to add the role to the user. (It looks like I added the wrong link in my original post. Here is the link to the authorization extension API docs.
Specifically, you can use this endpoint to add a role to your user in the authorization extension.