Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error retrieving files for the first time #74

Closed
alanbernstein opened this issue Sep 28, 2019 · 5 comments
Closed

Error retrieving files for the first time #74

alanbernstein opened this issue Sep 28, 2019 · 5 comments

Comments

@alanbernstein
Copy link

alanbernstein commented Sep 28, 2019

Just after signing in to my Dropbox account, when trying to get the file listing, I get an alert: There was an error retrieving files!. Then I see a debug page, with error message:

Unhandled Rejection (SyntaxError): Unexpected token E in JSON at position 0

(anonymous function)
src/org-web/src/sync_backend_clients/dropbox_sync_backend_client.js:84

  81 |   reader.readAsText(response.fileBlob);
  82 | })
  83 | .catch(error => {
> 84 |   if (!!error.error && JSON.parse(error.error).error.path['.tag'] === 'not_found') {
     | ^  85 |     reject();
  86 |   }
  87 | })

This is running locally on OSX.

@DanielDe
Copy link
Owner

Hey @alanbernstein, this seems to be working fine for me still, so this must be something unique to your setup.

Did you create your own Dropbox app for use with this, or are you using the one I've set up?

@alanbernstein
Copy link
Author

alanbernstein commented Sep 29, 2019

I may have misunderstood the setup instructions.

I tried running without making any changes, and I could view the sample file, but when I clicked the sign in button, then the Dropbox button, I saw this error: Error: A client id is required. You can set the client id using .setClientId().

Then I tried creating a .env file, using Dropbox credentials from an existing app of mine. Then I saw this error I reported above.

Now, trying again with the org-web app credentials, everything works, not sure what I changed I think I tried running it before I realized I needed to cp .env.sample .env. That will be enough for me to check out the app. I suppose I'd still like to use it with my Dropbox app credentials, so any guidance would be great. Thanks for your help!

@DanielDe
Copy link
Owner

@alanbernstein one possible problem is the configuration of the "Redirect URIs" in the Dropbox app console. You need to make sure that whatever URL you're accessing org-web from is listed as a valid Redirect URI for the app whose Dropbox key you're using. (and note that the trailing slash is important).

Here's what my Redirect URIs configuration section looks like:

image

Let me know if this solves it for you. Otherwise, maybe we can hop on a phone call sometime soon to work this out.

@alanbernstein
Copy link
Author

Ah, that does fix it for me. I don't have a great grasp of OAuth, so it's not clear to me why that worked. My .env file's CLIENT_ID and REDIRECT_URI both correspond to what was present in my own Dropbox app (my own URL and localhost), and that didn't work. I added the three org-web URIs from your example and then it worked.

If you want to make it easier for dummies like me to get this set up, it might be nice to add a little more info to the "Synchronization back-ends" section.

Anyway, thanks for your help!

@DanielDe
Copy link
Owner

DanielDe commented Oct 1, 2019

Great, glad to hear it! Those Redirect URIs are essentially telling Dropbox where its safe to redirect to after signing in. So note that if you end up hosting a version of org-web yourself somewhere, you'll need to also add that URL to this list as well.

I'll definitely update the README!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants