<?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: How to create refresh token automatically? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637243#M29369</link>
    <description>&lt;P&gt;Check out &lt;A href="https://github.com/dropbox/dropbox-sdk-java/tree/main/examples/examples/src/main/java/com/dropbox/core/examples/web_file_browser" target="_blank"&gt;the web_file_browser example&lt;/A&gt; for a sample of handling the authorization flow directly in a web app. That example doesn't happen to request offline access (to get a refresh token) but you can do so the same way if needed, using &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v5.4.3/com/dropbox/core/DbxWebAuth.Request.Builder.html#withTokenAccessType(com.dropbox.core.TokenAccessType)" target="_self"&gt;withTokenAccessType&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Nov 2022 19:23:02 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2022-11-16T19:23:02Z</dc:date>
    <item>
      <title>How to create refresh token automatically?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637209#M29366</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the refresh token for my web application and it works fine. However, the process of generating a refresh token offline that the user has to run the java app is not user friendly; the user has to run the app, clicks the output link, and then hits an Allow button; after that the user needs to copy the Authorization Code back to the program and enter is too much work. In addition, the users mostly are not developers so they do not have Java SDK or Maven to run the Java program. Is there anyway that I can provide the App key and the Secret Key and then generate the Refresh Key automatically?&amp;nbsp; The following code is the one that I use to create a refresh key.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;DbxAppInfo appInfo&lt;/SPAN&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;appInfo = DbxAppInfo.Reader.readFromFile(argAppInfoFile);&lt;BR /&gt;DbxAuthFinish authFinish = null;&lt;BR /&gt;authFinish = new PkceAuthorize().authorize(appInfo);&lt;/P&gt;
&lt;P&gt;DbxCredential credential = new DbxCredential(authFinish.getAccessToken(),&lt;BR /&gt;authFinish.getExpiresAt(),&lt;BR /&gt;authFinish.getRefreshToken(),&lt;BR /&gt;appInfo.getKey(),&lt;BR /&gt;appInfo.getSecret());&lt;BR /&gt;File output = new File(argAuthFileOutput);&lt;BR /&gt;try {&lt;BR /&gt;DbxCredential.Writer.writeToFile(credential, output);&lt;/P&gt;
&lt;P&gt;}&lt;BR /&gt;catch (IOException ex) {&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 22:44:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637209#M29366</guid>
      <dc:creator>tritnguyen</dc:creator>
      <dc:date>2022-11-16T22:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create refresh token automatically?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637216#M29367</link>
      <description>&lt;P&gt;No, it is not possible to fully automate the process of getting a refresh token. The user must authorize the app using the OAuth app authorization flow built into your app in order for the app to receive the resulting access token and optional refresh token. This needs to be done manually by the user at least once per Dropbox account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your app needs to maintain long-term access without the user manually re-authorizing it repeatedly, the app should request "offline" access so that it gets a refresh token. The refresh token doesn't expire and can be stored and used repeatedly to get new short-lived access tokens whenever needed, without the user manually reauthorizing the app.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 17:01:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637216#M29367</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-11-16T17:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create refresh token automatically?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637223#M29368</link>
      <description>&lt;P&gt;authFinish = new PkceAuthorize().authorize(appInfo);&lt;/P&gt;&lt;P&gt;Right now I have a separate Java program to generate a refresh token. The function above will show this instruction on the command line.&lt;/P&gt;&lt;P&gt;1. Go to &lt;A href="https://www.dropbox.com/oauth2/authorize?token_access_type=offline&amp;amp;response_type=code&amp;amp;code_challenge_method=S256&amp;amp;client_id=" target="_blank"&gt;https://www.dropbox.com/oauth2/authorize?token_access_type=offline&amp;amp;response_type=code&amp;amp;code_challenge_method=S256&amp;amp;client_id=&lt;/A&gt;&lt;BR /&gt;2. Click "Allow" (you might have to log in first).&lt;BR /&gt;3. Copy the authorization code.&lt;/P&gt;&lt;P&gt;If I call that function in my Java web app, then what is the result? If I cannot call that line above in my web application, what is the other option for me to try. I understand that the user needs to go thru all the steps, I just want to have it working with my web app.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 17:29:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637223#M29368</guid>
      <dc:creator>tritnguyen</dc:creator>
      <dc:date>2022-11-16T17:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create refresh token automatically?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637243#M29369</link>
      <description>&lt;P&gt;Check out &lt;A href="https://github.com/dropbox/dropbox-sdk-java/tree/main/examples/examples/src/main/java/com/dropbox/core/examples/web_file_browser" target="_blank"&gt;the web_file_browser example&lt;/A&gt; for a sample of handling the authorization flow directly in a web app. That example doesn't happen to request offline access (to get a refresh token) but you can do so the same way if needed, using &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v5.4.3/com/dropbox/core/DbxWebAuth.Request.Builder.html#withTokenAccessType(com.dropbox.core.TokenAccessType)" target="_self"&gt;withTokenAccessType&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 19:23:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-create-refresh-token-automatically/m-p/637243#M29369</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-11-16T19:23:02Z</dc:date>
    </item>
  </channel>
</rss>

