oh man... we had so much of this done years ago with Locker, but old services die and new services are born, and existing services change their APIs constantly... it takes a lot of work to keep them up to date! https://github.com/LockerProject/Locker
Lots of prior art here so I knew I was not reinventing the wheel. I guess I just had to see what the challenges were first hand!
FYI, if you have control over the repo ... the URL on the sidebar, "lookerproject dot org" goes to a scammy-looking crypto thing, might want to take that down.