I have setup OAuth2 in Salesforce along with Named Credentials and External Credentials. I am calling the File Upload API in the code..that works fine with all the above. I setup a second Named Credential that uses the shared External Credentials that the Upload API uses. The only real reason for this is the accomodate the different endpoints (why does Dropbox do this?). The Post to the Set Sharing /2/sharing/create_shared_link_with_settings endpoint uses the NamedCredential and gets a new/different bearer token. BUT, when that call is posted I get a 401 Unauthorized.
The response says:
{"error":{".tag":"missing_scope","required_scope":"sharing.write"},"error_summary":"missing_scope/"}
The APP I defined in DROPBOX has sharing.write...so a little confuse. Where can I pass in that scope?
Should I just generate a token in the APP for the one user...is that a permanent token that just replaces creds?
UPDATE: I did use the APPTOKEN and that seems a better approach and calling OAuth each time.
Its working, but now I have to figure out how to chunk load larger files. UGH
Thoughts? Is there any reason getting a second token on a second HTTP callout is a problem when calling the different API?