Since the issue is token related, please go to your app settings and check the permissions you want, especially files.content.write and regenerate a new token after saving the changes.
files.content.write