We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

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

405 Method Not Allowed

hi, this is may code:

var code = 'xxxxxxx';

var client = new HttpClient();
var url = string.Format("https://api.dropboxapi.com/oauth2/token?code={0}&grant_type={1}", code, "authorization_code");

client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

//GET Method
HttpResponseMessage response = await client.GetAsync(url);

 

but the response is: 405 method not allowed

 

any help ?

1 Reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    The /oauth2/token endpoint requires a POST, not a GET, so you're accordingly receiving a 405 error. Switch to using POST instead.

    You can find more information in the documentation:

    https://www.dropbox.com/developers/documentation/http/documentation#oauth2-token

    It looks like you're also missing the app key and secret, and redirect URI, if used. Make sure you format the request as documented and include all of the necessary parameters.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 2 days ago
411 Following

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 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!