Discuss Dropbox Developer & API
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
@pankajetal wrote:... I'm able to make the powershell script work using my access token but it won't work for other users.
...
$token= "https://www.dropbox.com/oauth2/authorize?client_id=<my app ID>&response_type=code"
...
Hi @pankajetal,
Since you can make you script work with access token, does the token that work for you look like the one you assigned above? 🧐😀
The above "token" is a web address where Dropbox OAuth starts. That's the place where you should redirect user to grant your application access to the data. 😉 You can take a look here for step by step exercise. There 'curl' is in use; I believe you can "translate" it for pawershell use.
Good luck.
@pankajetal wrote:... I'm able to make the powershell script work using my access token but it won't work for other users.
...
$token= "https://www.dropbox.com/oauth2/authorize?client_id=<my app ID>&response_type=code"
...
Hi @pankajetal,
Since you can make you script work with access token, does the token that work for you look like the one you assigned above? 🧐😀
The above "token" is a web address where Dropbox OAuth starts. That's the place where you should redirect user to grant your application access to the data. 😉 You can take a look here for step by step exercise. There 'curl' is in use; I believe you can "translate" it for pawershell use.
Good luck.
@pankajetal Здравко is correct; https://www.dropbox.com/oauth2/authorize is a web page, not a token or API call. You can find more information on how this works in the following resources:
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on Twitter or Facebook.
For more info on available support options, see this article.
If you found the answer to your question, please 'like' the post to say thanks to the user!