Forum Discussion

Ashish1's avatar
Ashish1
Explorer | Level 3
8 years ago

how to get Responce_type in client side?

Hi  Team

 Thanks in advance .i am working on mvc application and got some requirtment to attach   a file from drop box.i m useing drop box api where i need to redirect page  to  "https://www.dropbox.com/oauth2/authorize? client_id=___&redirect_uri=__/Auth&response_type=code"  to this url for authorization  and as retrun i get a code in the redirect_uri   to get acess token.but while calling this url my page get refresh and i loose my form value  as it redirect me to login page of dropbox.

is there is any solution  to handle this type of situation or can we get acess code from client side without refreshing the url?

 

Thanks.

 

4 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    You do need to send the user to the /oauth2/authorize page for them to authorize your app, so you can't get an authorization code directly on your own page.

    Instead though, you could look into either:

    1) sending them there in a pop-up or new tab/window, so that they don't lose the contents of your page

    or

    2) saving the relevant page state somewhere, such as in local storage or a cookie, or by sending it through the Dropbox OAuth app authorization flow in the 'state' parameter, as documented here: https://www.dropbox.com/developers/documentation/http/documentation#oauth2-authorize
  • Ashish1's avatar
    Ashish1
    Explorer | Level 3
    8 years ago

    Hi

    Thanks for your reply but opening in new pop up will load  the same page in current pop up not in the parent pop up box.

    saveing data in local storage could be headche as form data may be too much.

    is there ia any other solution?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    I listed everything that came to mind in my last post. I recommend using the "state" parameter on /oauth2/authorize.
  • Ashish1's avatar
    Ashish1
    Explorer | Level 3
    8 years ago

    ok


    Greg-DBwrote:
    I listed everything that came to mind in my last post. I recommend using the "state" parameter on /oauth2/authorize.


    .Thanks  :-)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If 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, Facebook or Instagram.

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!