You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
bbijals
7 years agoExplorer | Level 4
Chrome Extension "Download to Dropbox"
I have a Chrome extension developed using Angular JS and High Charts. I need a functionality to be added to upload files to dropbox from this chrome based app. I have written a code to authorize ...
- 7 years ago
2. Regardless of the type of app, the redirect URI would be the URI where you want to send the user back to after they approve your app to access their account. I can't offer guidance on how to build a Chrome extension in particular, but I know Chrome extensions sometimes use "chrome-extension://" URLs for their option pages, so you may want to look into that. I recommend reading the OAuth guide for context on how the flow works.
(Also, if you use the "code" flow, the redirect URI isn't strictly required. If you omit it, the user just needs to copy/paste the authorization code into your app.)
4. No, the user does not need to register their own API app. Your app uses its own app key to send them though the OAuth app authorization flow. I recommend trying the example to see how it works.
Production status just removes the limit on the number of users that can connect to your app.
In your code, you're attempting to make a GET request to the /oauth2/authorize page. You instead need to send the user to that page as a normal navigation operation. E.g., have them click on the link as shown in the example, or redirect them via JavaScript, such as using window.location.replace(url) or window.location.href.
bbijals
Explorer | Level 4
2. Our app is not a hosted web application but a chrome extension based app and does not have the url of its own. In that case, what would be the redirect url or the domain?
4. I would like to rephrase my question. Currently I have used my own dropbox account to register the app onto dropbox. Do my all users will also have to register /create an app on to dropbox? What is Production status used for?
My code to connect to dropbox looks like this:
Please let me know what I am doing wrong here.
Regards,
Bijal
Greg-DB
7 years agoDropbox Staff
2. Regardless of the type of app, the redirect URI would be the URI where you want to send the user back to after they approve your app to access their account. I can't offer guidance on how to build a Chrome extension in particular, but I know Chrome extensions sometimes use "chrome-extension://" URLs for their option pages, so you may want to look into that. I recommend reading the OAuth guide for context on how the flow works.
(Also, if you use the "code" flow, the redirect URI isn't strictly required. If you omit it, the user just needs to copy/paste the authorization code into your app.)
4. No, the user does not need to register their own API app. Your app uses its own app key to send them though the OAuth app authorization flow. I recommend trying the example to see how it works.
Production status just removes the limit on the number of users that can connect to your app.
In your code, you're attempting to make a GET request to the /oauth2/authorize page. You instead need to send the user to that page as a normal navigation operation. E.g., have them click on the link as shown in the example, or redirect them via JavaScript, such as using window.location.replace(url) or window.location.href.
- bbijals7 years agoExplorer | Level 4
Based on reply, I have done changes to my code and It is redirecting me to the dropbox login page. After I login, It prompts me to allow the app. Once I allow the app, It shows the authorization code on screen since I have used the code flow.
I wanted to use the token flow for authorization so that I can directly get the token. This is how I am building my url for the token flow:
var redirectUri = encodeURIComponent('chrome-extension://sdfsdsdfbohbmkkjdhmdhokipgllnasdfdsfsdfdsfipnfopjnng.chromiumapp.org');
console.log(redirectUri);
var auth_url = "https://www.dropbox.com/oauth2/authorize?client_id=" + client_id + "&redirect_uri=" + redirectUri + "&response_type=token";
When I allow the app, i get following message
When I click on 'Allow' on the above screen, I get another message "you will need a new app to open this chrome extension"
Is there a way to get the token back to the calling app which is a chrome extension?
- Greg-DB7 years agoDropbox StaffUsing redirect_uri to set a redirect URI for the OAuth app authorization flow is the correct way to automatically receive the resulting code or token.
It looks like you already have that, and the Dropbox web site is serving the redirect requested. After that, the browser/computer/user is in control of what happens, e.g., what app/extension that goes to, if it's allowed, etc.
Unfortunately, since that part is not-specific to Dropbox and out of our control, I'm afraid I can't offer any specific help. You may want to refer to the documentation for Chrome extensions in general to see if/how you can receive a redirect into your Chrome extension.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,912 PostsLatest Activity: 9 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!