<?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: help: long-live tokens for dropbox app in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747288#M32838</link>
    <description>&lt;P&gt;No, a redirect URI is not required to get a refresh token. Whether or not a redirect URI is used though, the manual authorization step does need to be handled by the user manually in order to authorize the app to access their account and receive a refresh token. This only needs to be done once per account though; the refresh token can then be stored and re-used programmatically without the user present.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jan 2024 18:47:35 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2024-01-26T18:47:35Z</dc:date>
    <item>
      <title>help: long-live tokens for dropbox app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747272#M32833</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;&lt;BR /&gt;I know that there are other issues related to this but I did not find anything that really helped me.&lt;BR /&gt;I'm trying to upload images (.png) from my PC to dropbox via an application that I already created.&lt;BR /&gt;I'm doing this using a python script I wrote. The part that concerns the dropbox upload is the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;def upload_to_dropbox(file_path, dropbox_token, dropbox_folder):&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; dbx = dropbox.Dropbox(dropbox_token)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; with open(file_path, 'rb') as f:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; filename = os.path.basename(file_path)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dropbox_path = dropbox_folder+filename&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dbx.files_upload(f.read(), dropbox_path)&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; shared_link_metadata = dbx.sharing_create_shared_link(dropbox_path)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; return shared_link_metadata.url&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;In doing this I'm using an access token that I generate in the Console App. This token begins with "sl" and I know that expires in few hours.&amp;nbsp;&lt;BR /&gt;Could you please provide me support on how to get a long-live token, or how to refresh automatically the token I'm using?&lt;BR /&gt;&lt;BR /&gt;Thank you in advance &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;BR /&gt;&lt;BR /&gt;D.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 26 Jan 2024 17:58:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747272#M32833</guid>
      <dc:creator>dpellic996</dc:creator>
      <dc:date>2024-01-26T17:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: help: long-live tokens for dropbox app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747276#M32834</link>
      <description>&lt;P&gt;Dropbox is no longer offering the option for creating new long-lived access tokens. Dropbox is now 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;&amp;nbsp;&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. You can find more information in the &lt;A href="https://developers.dropbox.com/oauth-guide" rel="noopener noreferrer" target="_blank"&gt;OAuth Guide&lt;/A&gt; and &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#authorization" rel="noopener noreferrer" target="_blank"&gt;authorization documentation&lt;/A&gt;. There's a basic outline of processing this flow in &lt;A href="https://dropbox.tech/developers/using-oauth-2-0-with-offline-access" rel="noopener noreferrer" target="_blank"&gt;this blog post&lt;/A&gt; which may serve as a useful example.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;The official Dropbox SDKs can handle this automatically for you. For &lt;A href="https://github.com/dropbox/dropbox-sdk-python" rel="noopener noreferrer" target="_blank"&gt;the official Dropbox Python SDK&lt;/A&gt;, you can find examples of this flow at the following links:&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL dir="auto"&gt;
&lt;LI&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-python/blob/main/example/oauth/commandline-oauth-scopes.py" rel="noopener noreferrer" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-python/blob/main/example/oauth/commandline-oauth-scopes.py&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-python/blob/main/example/oauth/commandline-oauth-pkce.py" rel="noopener noreferrer" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-python/blob/main/example/oauth/commandline-oauth-pkce.py&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 26 Jan 2024 17:59:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747276#M32834</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2024-01-26T17:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: help: long-live tokens for dropbox app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747283#M32835</link>
      <description>&lt;P&gt;Thank you but I have still a doubt on this..&lt;BR /&gt;&lt;BR /&gt;I don't know any REDIRECT URI.. how can I get one? What's the criterion I could use to choose one? Actually is the only thing I still don't have.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 18:31:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747283#M32835</guid>
      <dc:creator>dpellic996</dc:creator>
      <dc:date>2024-01-26T18:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: help: long-live tokens for dropbox app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747285#M32836</link>
      <description>&lt;P&gt;The redirect URI is the location where the user should be sent after they authorize the app to access their account. It should be a URI controlled by your app and defined by you as the developer of the app. That being the case, I can't tell you exactly what yours should be, but for example, if you're building a web app and your redirect URI for your development environment looks like &lt;A href="http://localhost/auth" rel="noopener noreferrer" target="_blank"&gt;http://localhost/auth&lt;/A&gt;, then it would typically look like &lt;A href="https://example.com/auth" rel="noopener noreferrer" target="_blank"&gt;https://example.com/auth&lt;/A&gt; in the deployed environment. For reference, it is optional; you can opt to not use a redirect URI, in which case you would omit that parameter and the user would need to manually copy/paste the authorization code. For instance, the Python SDK samples I linked to don't use a redirect URI.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 18:36:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747285#M32836</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2024-01-26T18:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: help: long-live tokens for dropbox app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747286#M32837</link>
      <description>&lt;P&gt;So, if I got it right, using a redirect URI is the only way for generating a refresh token automatically (i.e. not manually by authorizing by myself)?&lt;BR /&gt;&lt;BR /&gt;sorry for the confusion, i'm not very into these things and I find this very complicated!&lt;BR /&gt;&lt;BR /&gt;D.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 18:44:56 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747286#M32837</guid>
      <dc:creator>dpellic996</dc:creator>
      <dc:date>2024-01-26T18:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: help: long-live tokens for dropbox app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747288#M32838</link>
      <description>&lt;P&gt;No, a redirect URI is not required to get a refresh token. Whether or not a redirect URI is used though, the manual authorization step does need to be handled by the user manually in order to authorize the app to access their account and receive a refresh token. This only needs to be done once per account though; the refresh token can then be stored and re-used programmatically without the user present.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 18:47:35 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747288#M32838</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2024-01-26T18:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: help: long-live tokens for dropbox app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747332#M32839</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1798015"&gt;@dpellic996&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;BR /&gt;sorry for the confusion, i'm not very into these things and I find this very complicated!&lt;BR /&gt;...&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/1798015"&gt;@dpellic996&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;As Greg already noted, you can initiate and perform authorization (granting access to particular account data) either by hand (without redirect URI; copy-past access code by hand) or automated (automatic redirect from Dropbox site back to your application). An example, that uses redirect URL and that you can take a look on, can be seen &lt;A href="https://www.dropboxforum.com/t5/Create-upload-and-share/How-can-a-script-or-app-get-a-shareable-Dropbox-link/m-p/680736" target="_blank" rel="noopener"&gt;here&lt;/A&gt;. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt; I believe this will give you idea how the things could go.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 22:22:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/help-long-live-tokens-for-dropbox-app/m-p/747332#M32839</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2024-01-26T22:22:32Z</dc:date>
    </item>
  </channel>
</rss>

