Pipeline Rule and custom Flow Action are not working at legacy API: /oauth/ro

Hi, I need to add some custom attribute to idToken for an old project.
At first I added a rule to achieve it.
My rule function is like this:

function addPersistenceAttribute(user, context, callback) {
  context.idToken['https://example.com/hello'] = 'hello';
  callback(null, user, context);

After trying to login by username/password using the legacy api: https://<auth0_domain>/oauth/ro
the idToken I receive then extract jwt, but it does not contain the custom attribute.
But when I try to login by username/password using the new api: https://<auth0_domain>/oauth/token
It works, the idToken contains the custom attribute I added.
One more thing, it happens only when I use the legacy API: password and passwordless login, but for the social login by Google, it works well.

The issue also happens the same with the custom Action in authentication flow.

So anyone can confirm that Rule is working with the legacy API or not? because my project is really old, so I’m not sure about updating it too much