Upload avatar image with API

I was wondering if it’s possible for an application to send a discord auth token to discourse to upload / download a file from discourse?

That is, currently users by default can upload up to 4096 KB for avatar pics. I have discord oauth already setup and working. Can an app communicate and send the same request (maybe via SSO?) to discourse to upload or download a file?

If so, how would that request from the app work?