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

Basic authentication code example refers to non-existent files #992

Closed
RichardJECooke opened this issue Jul 29, 2022 · 5 comments
Closed
Labels

Comments

@RichardJECooke
Copy link

Describe the bug
Downloading this code sample, https://github.com/dropbox/dropbox-sdk-js/blob/main/examples/javascript/auth/index.html, and running it in a browser gives errors.

Some files, like the utils.js and css files, are easily found higher up in the file tree and I can fix your code by changing the reference. But <script src="/__build__/Dropbox-sdk.min.js"></script> doesn't exist anywhere.

To Reproduce
Download the code samples and open https://github.com/dropbox/dropbox-sdk-js/blob/main/examples/javascript/auth/index.html in a browser.

Expected Behavior
It works

Actual Behavior
Errors

@RichardJECooke
Copy link
Author

After deleting <script src="/__build__/Dropbox-sdk.min.js"></script> and adding <script src="../../../node_modules/dropbox/dist/Dropbox-sdk.js" type="module"></script> the page finally runs, but it gives the error Uncaught ReferenceError: Dropbox is not defined in the section

else {
    showPageSection("pre-auth-section");
    // Set the login anchors href using dbx.getAuthenticationUrl()
    var dbx = new Dropbox.Dropbox({
        clientId: CLIENT_ID
    });

@greg-db
Copy link
Contributor

greg-db commented Jul 29, 2022

The "/__build__/Dropbox-sdk.min.js" reference is meant to point to the built version of the SDK, so you'd need to follow the instructions here to build it and run the examples.

Alternatively, you can replace that reference with a built version of the SDK, e.g., from a CDN of your choice, instead, such as on npmcdn

@greg-db greg-db closed this as completed Jul 29, 2022
@RichardJECooke
Copy link
Author

I followed the instructions you posted, thanks, https://github.com/dropbox/dropbox-sdk-js/tree/main/examples/javascript. I cloned the repo, npm install, and ran the program, but it just gives me an error:

dropbox_sdk/examples/javascript$ node ./server.js
/home/rje/mi/code/dropbox_sdk/node_modules/rollup-endpoint/index.js:15
    throw Error('[rollup-endpoint] File does not exist: ' + options.entry);
    ^

Error: [rollup-endpoint] File does not exist: /home/rje/mi/code/dropbox_sdk/dist/Dropbox-sdk.js
    at Object.exports.serve (/home/rje/mi/code/dropbox_sdk/node_modules/rollup-endpoint/index.js:15:11)
    at Object.<anonymous> (/home/rje/mi/code/dropbox_sdk/examples/javascript/server.js:12:10)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

@RichardJECooke
Copy link
Author

RichardJECooke commented Aug 18, 2022

This documentation bug seems to be already here a year ago: #621

@greg-db
Copy link
Contributor

greg-db commented Aug 18, 2022

@RichardJECooke Thanks for the note. I'll follow up with you on #621 and your new issue #1001.

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

No branches or pull requests

2 participants