401 unauthorized on token exchange

Hi, I’ve got a machine to machine application and when I’m trying to do an Auth Flow with PKCE I’m getting unauthorized.
I have another app which is a single page app and it’s configured just the same as my machine to machine app but somehow I’m getting unauthorized on machine to machine app (which also has an API bound to it) and on the single page app everything is working fine. What am I doing wrong?

Hello @igor.gembula,

This is likely because the Authorization Code grant is not enabled in the Machine-to-Machine application by default.

You can enable the grant manually via Dashboard by going to Applications > Applications > select Application > under the Settings tab, scroll down to Advanced Settings and select Grant Types tab:

This is not recommended, as the Machine-to-Machine applications are configured to allow only the Client Credentials flow.