If the Dropbox API call is failing, you should get a more specific error from the API. It sounds like you're only retrieving a generic error message though. Please inspect the exception, e.g., using the debugger, to get more information.
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?