Experimenting with whether we can easily automate downloading the weekly backup files, based on Enrico Murru's approach here
We are trying to use c# because we use that a lot already and dont want to spin up node unless we have to.
We are running into authentication issues when we hit the data export page, so am doing some testing in postman.
We can successfully hit the data export page by copying my session Id from my browser cookies, and setting a header with key = "Cookie" and value = "sid=sessionidcopiedfrombrowsercookies..." and doing a GET on the export data url
https://{instanceurl}/ui/setup/export/DataExportPage/d?
However, we cannot get to the data export page by using the access token generated by the username password flow with a connected app set to web scope. We get redirected to the login page, so its not accepting the access token. I have tried passing the access token as a cookie as well as in the authorization header. I have tried adding all possible scopes to the connected app.
This documentation on oauth scopes
indicates that web
scope should allow for accessing the web ui, and specifically that it "allows use of the access_token on the web."
And this doc on the username password flow indicates that the username password flow specifically generates the access token as session ids, which seems like it should work like the session Id I steal from the browser cookie. Note that I can successfully generate the access token via a POST to the token endpoint, I just cannot use it with web scope.
The username-password flow generates access tokens as Salesforce Session IDs
My question: how can we leverage the access token generated by username - password flow to access the data export page via the web? What am I missing here? Is there a better way to get to the data export page? We can setup an oauth flow, or use a library if it will help.
Note : I understand username password flow is very weak. The integration user will only have permission to export the data, and we will lock down ip ranges, and could use a different flow once we can get it working.
UPDATE - I tried posting to the frontdoor and am not able to hit the data export page. The page that is loaded has a single function redirectOnLoad(). This is what I am assuming is the login page as it did not matter if I included the sid param / access token. Am I supposed to do something with this page to get to the page I want?