Rushik
Rushik

Reputation: 120

How to solve this error The remote server returned an error: (401) Unauthorized using Dropbox developer API

I have configure dropbox developer API in c#. and pass token and secretkey in below method.

OAuthToken oauth = new OAuthToken(DropboxAccessToken,DropboxAccessSecretKey);
var api = new DropboxApi(ConsumerKey, ConsumerSecret, oauth);'''
var account = api.GetAccountInfo(); 

Last statement raise "The remote server returned an error: (401) Unauthorized" this error. Please help me how to solve this and please let me know if any missing condition or steps.

Upvotes: 0

Views: 296

Answers (1)

Greg
Greg

Reputation: 16930

Based on the code you shared, it looks like you're trying to use OAuth 1 with Dropbox API v1. (OAuth 1 uses separate access token key and secrets parts, whereas OAuth 2 uses a single bearer access token. Also, the GetAccountInfo method name indicates Dropbox API v1.)

Dropbox API v1, along with the use of OAuth 1 with it, are retired now. You should instead use Dropbox API v2 with OAuth 2. For .NET, we recommend using the official Dropbox API v2 .NET SDK. It includes instructions for getting started, full documentation, and example apps.

Upvotes: 1

Related Questions