Welcome back to the SmartThings Community, @taasss!
If this was years ago, it seems you’re working with a Groovy SmartApp that gave you these permissions, is it correct?
Just so you know, that is part of our Legacy platform, which is getting into a sunset (please, take a look at this announcement).
Which tasks are sending the 400 error?
I think you can use requests to the API instead, using a Personal Access Token and you wouldn’t need the OAuth flow.
Also, you can share the values you use to get the token, etc. to make some tests.