<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trying to get token to work or set expiration date to long time in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/656001#M29864</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1614565"&gt;@kdss-ja&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Question will this AccessToken last for long time?&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1614565"&gt;@kdss-ja&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;If&amp;nbsp;as long time, you mean 4 hours or so - Yes, otherwise - No. Doesn't matter how you gonna get your access token, it's always short lived.&lt;/P&gt;&lt;P&gt;Read with some more care Greg's comments above! The Dropbox client object can manage the access token refresh for you. To be possible, you need to pass the refresh token too (for use in the refresh process), otherwise once the passed access token expired exception gonna be thrown. More precise directions how you can construct client objects can be seen &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/blob/main/dropbox-sdk-dotnet/Examples/OauthBasic/Program.cs#L87" target="_blank" rel="noopener"&gt;here&lt;/A&gt; (non PKCE) and &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/blob/main/dropbox-sdk-dotnet/Examples/OAuthPKCE/Program.cs#L83" target="_blank" rel="noopener"&gt;here&lt;/A&gt; (PKCE). Note that parameters don't exclude the refresh token there, as you are doing. Actually the access token can be removed everywhere (if suitable).&lt;/P&gt;&lt;P&gt;Hope this sheds additional light.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 13:49:02 GMT</pubDate>
    <dc:creator>Здравко</dc:creator>
    <dc:date>2023-02-02T13:49:02Z</dc:date>
    <item>
      <title>Trying to get token to work or set expiration date to long time</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655765#M29858</link>
      <description>&lt;P&gt;I've copied the example code in SimpleTest and got access token working but expires after short time&lt;/P&gt;
&lt;P&gt;I've just want very simple way to write and read files from my drop box programmatically. (and share the app with others on same drop box )&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GetAccessToken works but it expires after short time expires&lt;/P&gt;
&lt;P&gt;Is there way to set expiration date or refresh the token, I've tried for several hours&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;string[] scope = { "account_info.read", "files.content.read", "files.content.write" };&lt;BR /&gt;await client.RefreshAccessToken(scope); //didn't work&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;please send me C# code example not curl&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 08:06:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655765#M29858</guid>
      <dc:creator>kdss-ja</dc:creator>
      <dc:date>2023-02-02T08:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get token to work or set expiration date to long time</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655774#M29859</link>
      <description>&lt;P&gt;Dropbox is no longer offering the option for creating new long-lived access tokens, and does not offer an option for setting an arbitrary access token expiration length. Dropbox is switching to only issuing short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens. You can find &lt;A href="https://dropbox.tech/developers/migrating-app-permissions-and-access-tokens#updating-access-token-type" rel="noopener noreferrer" target="_blank"&gt;more information on this migration here&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Apps can still get long-term access by requesting "offline" access though, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. If you're using .NET, we recommend using &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet" rel="noopener noreferrer" target="_blank"&gt;the official Dropbox API v2 .NET SDK&lt;/A&gt;.&amp;nbsp;When you use the official Dropbox API v2 .NET SDK, the SDK will handle the refresh process for you automatically, as long as you provide the necessary credentials (that is, the refresh token, the app key, and the app secret when not using PKCE). You can find &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/tree/main/dropbox-sdk-dotnet/Examples" rel="noopener noreferrer" target="_blank"&gt;examples of using this in C# here&lt;/A&gt;. In particular, there's &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/tree/main/dropbox-sdk-dotnet/Examples/OauthBasic" target="_blank"&gt;the OauthBasic example&lt;/A&gt; which shows how to do this with the non-PKCE flow (for server-side apps) and &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/tree/main/dropbox-sdk-dotnet/Examples/OAuthPKCE" target="_blank"&gt;the OAuthPKCE example&lt;/A&gt; which shows how to do this with the PKCE flow (for client-side apps).&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 20:58:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655774#M29859</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-02-01T20:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get token to work or set expiration date to long time</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655792#M29860</link>
      <description>&lt;P&gt;Thanks trying to get the basic example working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Invalid redirect_uri. It must exactly match one of the redirect URIs you've pre-configured for your app (including the path).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've added these paths to the App&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;Redirect URIs&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;A href="http://localhost:5000/Home/Auth" target="_blank" rel="noopener"&gt;http://localhost:5000/Home/Auth&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;A href="https://www.dropbox.com/1/oauth2/display_token" target="_blank" rel="noopener"&gt;https://www.dropbox.com/1/oauth2/display_token&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;A href="http://localhost:5000/" target="_blank" rel="noopener"&gt;http://localhost:5000/&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;A href="http://localhost:5000/authorize" target="_blank" rel="noopener"&gt;http://localhost:5000/authorize&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;A href="https://www.dropbox.com/developers/apps" target="_blank" rel="noopener"&gt;https://www.dropbox.com/developers/apps&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" rel="noopener"&gt;https://www.dropbox.com/oauth2/authorize?response_type=code&amp;amp;client_id=&amp;lt;appkey&amp;gt;&amp;amp;redirect_uri=http%3A%2F%2F127.0.0.1%3A5000%2Fauthorize&amp;amp;state=e9b63a7614cd4f1db3820fc1daed8ec2&amp;amp;token_access_type=offline&amp;amp;scope=files.metadata.read%20files.content.read%20account_info.read&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help much appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 21:35:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655792#M29860</guid>
      <dc:creator>kdss-ja</dc:creator>
      <dc:date>2023-02-01T21:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get token to work or set expiration date to long time</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655831#M29861</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After continuous effort, changed 127.0.0.1 to localhost to get it redirect working.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Next Issue: &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;still can get this to work, thanks in advance!&lt;/P&gt;&lt;P&gt;//give all scope&lt;/P&gt;&lt;P&gt;string[] scopeList = new string[6] { "files.metadata.read", "files.content.read", "account_info.read", "files.metadata.write", "files.content.write", "file_requests.write" };&lt;/P&gt;&lt;P&gt;//succesfully acquire tokens&lt;BR /&gt;var uid = await this.AcquireAccessToken(scopeList, IncludeGrantedScopes.None);&lt;/P&gt;&lt;P&gt;HttpClient httpClient = new HttpClient();&lt;/P&gt;&lt;P&gt;try&lt;BR /&gt;{&lt;BR /&gt;var config = new DropboxClientConfig("ArgusCE")&lt;BR /&gt;{&lt;BR /&gt;HttpClient = httpClient&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;Console.WriteLine("Attempting to try again with include_granted_scopes");&lt;BR /&gt;await this.AcquireAccessToken(scopeList, IncludeGrantedScopes.User);&lt;/P&gt;&lt;P&gt;client = new DropboxClient(AccessToken, ApiKey, ApiSecret, config);&amp;nbsp; //note accesstoken was acquired successfully&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//create new dropbox client but when call&amp;nbsp;&lt;/P&gt;&lt;P&gt;await client.Files.ListFolderAsync(Path);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also calling&amp;nbsp;var full = await client.Users.GetCurrentAccountAsync(); fails?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;throws exception&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Response status code does not indicate success: 400 (Bad Request).&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 23:13:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655831#M29861</guid>
      <dc:creator>kdss-ja</dc:creator>
      <dc:date>2023-02-01T23:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get token to work or set expiration date to long time</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655838#M29862</link>
      <description>&lt;P&gt;Narrowing it down&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Client = new DropboxClient(AccessToken, ApiKey, ApiSecret, config); //this doesn't work throws exception&lt;BR /&gt;Client = new DropboxClient(AccessToken, config); //this works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question will this AccessToken last for long time?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 23:40:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/655838#M29862</guid>
      <dc:creator>kdss-ja</dc:creator>
      <dc:date>2023-02-01T23:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get token to work or set expiration date to long time</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/656001#M29864</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1614565"&gt;@kdss-ja&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Question will this AccessToken last for long time?&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1614565"&gt;@kdss-ja&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;If&amp;nbsp;as long time, you mean 4 hours or so - Yes, otherwise - No. Doesn't matter how you gonna get your access token, it's always short lived.&lt;/P&gt;&lt;P&gt;Read with some more care Greg's comments above! The Dropbox client object can manage the access token refresh for you. To be possible, you need to pass the refresh token too (for use in the refresh process), otherwise once the passed access token expired exception gonna be thrown. More precise directions how you can construct client objects can be seen &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/blob/main/dropbox-sdk-dotnet/Examples/OauthBasic/Program.cs#L87" target="_blank" rel="noopener"&gt;here&lt;/A&gt; (non PKCE) and &lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/blob/main/dropbox-sdk-dotnet/Examples/OAuthPKCE/Program.cs#L83" target="_blank" rel="noopener"&gt;here&lt;/A&gt; (PKCE). Note that parameters don't exclude the refresh token there, as you are doing. Actually the access token can be removed everywhere (if suitable).&lt;/P&gt;&lt;P&gt;Hope this sheds additional light.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 13:49:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/656001#M29864</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2023-02-02T13:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get token to work or set expiration date to long time</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/656196#M29877</link>
      <description>&lt;P&gt;Ok thanks I was just trying to follow the basic sample.&lt;/P&gt;&lt;P&gt;I would suggest you update the samples to make them work, reading the doco is confusing.&lt;/P&gt;&lt;P&gt;But this does work (again remove the other constructors or get them to throw appropriate exceptions)&lt;/P&gt;&lt;P&gt;new DropboxClient(AccessToken, RefreshToken, ApiKey, ApiSecret, config);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm only using drop box as simple way to share files between people (having trouble with the simple)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 21:26:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Trying-to-get-token-to-work-or-set-expiration-date-to-long-time/m-p/656196#M29877</guid>
      <dc:creator>kdss-ja</dc:creator>
      <dc:date>2023-02-02T21:26:20Z</dc:date>
    </item>
  </channel>
</rss>

