Redirection is not available on /oauth/token endpoint

Our team frequently answers questions like this one.

The error you’re encountering usually happens when a redirect is triggered within an Action during a trigger that doesn’t allow redirects, such as during a refresh token exchange. The solution is to add logic to bypass the redirect in these cases.

See documentation for more details:
Redirection is not available on /oauth/token endpoint

Hope this helps