Hi- I'm working on a project when I need to download different user files from dropbox to a network share (to be consumed by some other application).
I've very limited knowledge of powershell script and authentication. I'm able to make the powershell script work using my access token but it won't work for other users.
I want to capture the access code generated and pass it as token but I'm getting "The given OAuth 2 access token is malformed" error. Is the below even correct? Please help.
$token= "https://www.dropbox.com/oauth2/authorize?client_id=<my app ID>&response_type=code"
$destination = "\\serverlocation\file.extension"
$headers = @{
'Authorization' = "Bearer " + $token
'Dropbox-API-Arg' = '{"path": "/Dropboxfolder/file.extension"}'
}
Invoke-RestMethod -Method Post -Uri https://content.dropboxapi.com/2/files/download -Headers $headers -ContentType 'application/octet-stream; charset=utf-8'-OutFile $destination