I have a use case where I need to use an external API with OAuth2 authentication in a Forge app from a backend service, a workflow post-function in this case.
My post-function needs to send an email with attachments to a given email address. Since it needs to include attachments, I cannot use the Jira notification REST API (which otherwise would have been perfect for this).
The withProvider() approach gets me 90% to my goal but lets me down when trying to use it from a back-end function that runs outside the scope of a specific user (something like api.asApp().withProvider() does not exist).
Ideally, I would like to be able to set up a connection to a specific email account for the whole app to use.
It does not look like I can get the credentials from the Forge API (otherwise I could store those and make simple fetch calls).
Any other suggestions?