<?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 retrieve access code automatically - javascript in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657397#M29935</link>
    <description>&lt;P&gt;Hey!&lt;BR /&gt;I'm trying to connect to Dropbox using Oauth and I cant figure out a way to retrieve the access code automatically.&lt;BR /&gt;I want that after I press connect in my site and the user press continue and then allow to retrieve the access code with no more user interaction' later I will use this access code to obtain access token.&lt;BR /&gt;can you please provide an example how to do that? there is an API call of dropbpx-sdk for that?&lt;BR /&gt;Thank you very much in advance!&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2023 20:41:51 GMT</pubDate>
    <dc:creator>env</dc:creator>
    <dc:date>2023-02-08T20:41:51Z</dc:date>
    <item>
      <title>retrieve access code automatically - javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657397#M29935</link>
      <description>&lt;P&gt;Hey!&lt;BR /&gt;I'm trying to connect to Dropbox using Oauth and I cant figure out a way to retrieve the access code automatically.&lt;BR /&gt;I want that after I press connect in my site and the user press continue and then allow to retrieve the access code with no more user interaction' later I will use this access code to obtain access token.&lt;BR /&gt;can you please provide an example how to do that? there is an API call of dropbpx-sdk for that?&lt;BR /&gt;Thank you very much in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 20:41:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657397#M29935</guid>
      <dc:creator>env</dc:creator>
      <dc:date>2023-02-08T20:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: generate code by using curl dropbox api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657396#M29939</link>
      <description>&lt;P&gt;Hey!&lt;BR /&gt;I'm trying to connect to Dropbox using Oauth and I cant figure out a way to retrieve the access code automatically.&lt;BR /&gt;I want that after I press connect in my site and the user press continue and then allow to retrieve the access code with no more user interaction' later I will use this access code to obtain access token.&lt;BR /&gt;can you please provide an example how to do that? there is an API call of dropbpx-sdk for that?&lt;BR /&gt;Thank you very much in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:33:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657396#M29939</guid>
      <dc:creator>env</dc:creator>
      <dc:date>2023-02-07T15:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: generate code by using curl dropbox api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657398#M29940</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1569375"&gt;@env&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;BR /&gt;can you please provide an example how to do that? there is an API call of dropbpx-sdk for that?&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/1569375"&gt;@env&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You didn't mention what SDK you are using. If you use Python, then an example can be seen &lt;A href="https://www.dropboxforum.com/t5/View-download-and-export/Key-Command-Shortcut-to-quot-Copy-Dropbox-Link-quot-from-Mac/m-p/651855/highlight/true#M42259" target="_blank" rel="noopener"&gt;here&lt;/A&gt;. If you use some other SDK you can adapt the same idea. &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;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:40:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657398#M29940</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2023-02-07T15:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: generate code by using curl dropbox api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657399#M29941</link>
      <description>&lt;P&gt;Sorry you right, I'm using javascript..&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:44:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657399#M29941</guid>
      <dc:creator>env</dc:creator>
      <dc:date>2023-02-07T15:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: generate code by using curl dropbox api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657406#M29942</link>
      <description>&lt;P&gt;It depends where are you using javascript. If you use browser session, better rely on Dropbox user session. In such a way you don't need any code or refresh token management. If you use javascript for standalone client side application or server application (node for instance), use something like my previous example. Both SDKs are very similar or similar enough at least.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:52:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657406#M29942</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2023-02-07T15:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve access code automatically - javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657416#M29943</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1569375"&gt;@env&lt;/a&gt; I see you posted the same question in two threads, so I've combined them here in one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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. 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;. &lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;For examples of implementing this with &lt;A href="https://github.com/dropbox/dropbox-sdk-js" target="_blank"&gt;the Dropbox JavaScript SDK&lt;/A&gt;, please refer to the examples included in &lt;A href="https://github.com/dropbox/dropbox-sdk-js/tree/main/examples/javascript" rel="noopener noreferrer" target="_blank"&gt;the "examples" folder in the SDK&lt;/A&gt;. As long as you set the app key (a.k.a. client ID) and refresh token, like shown in &lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/b5631e4b5b0e9eb6d3297e1ee57ad29a63d49898/examples/javascript/PKCE-backend/code_flow_example.js#L38" rel="noopener noreferrer" target="_blank"&gt;this example for the JavaScript SDK&lt;/A&gt;, the SDK will actually handle refresh process for you automatically. The SDK will automatically catch expired access token errors and call the API to get a new short-lived access token when needed.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:57:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657416#M29943</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-02-07T15:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve access code automatically - javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657827#M29947</link>
      <description>&lt;P&gt;First of all Thank you very much for your respond!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="env_0-1675860306707.png" style="width: 400px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/35070i1C390BF8C8B35A50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="env_0-1675860306707.png" alt="env_0-1675860306707.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I cloned the javascript example from the link you brought.&lt;BR /&gt;I get this error, which means it does not work on a Dropbox Business team - the app I have.&lt;BR /&gt;should it work on&amp;nbsp;Dropbox Business team app or just&amp;nbsp;on a single Dropbox account? if so, can you provide an example for&amp;nbsp;Dropbox Business team app?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 12:53:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657827#M29947</guid>
      <dc:creator>env</dc:creator>
      <dc:date>2023-02-08T12:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve access code automatically - javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657829#M29949</link>
      <description>&lt;P&gt;Finally I would like to connect our product to the Dropbox Business app, And our clients will only need to put their user name and password for the Dropbox website, can I make it fully automated? it can be either in Java/Javascript. can you provide examples in both languages (Java - the flow start from getting the access code all the way to refresh the token once it is in our system, Javasript - start from getting the access code all the way to the callback function).&lt;BR /&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 13:00:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657829#M29949</guid>
      <dc:creator>env</dc:creator>
      <dc:date>2023-02-08T13:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve access code automatically - javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657886#M29952</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1569375"&gt;@env&lt;/a&gt;, As noted in the error message, you got, you need to specify which team member should be impersonated. While a personal account can represent single user only, team account represents least 3 members/users! That's why for team account you need to specify concrete member. During OAuth2 flow you get such ID. Keep that ID and take a look &lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/main/examples/typescript/team-as-user/index.js#L15" target="_blank" rel="noopener"&gt;here&lt;/A&gt; how you can use it. You may need to specify default namespace too! By default (if nothing else specified) member home folder (not account root) is assumed as a root.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 15:52:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657886#M29952</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2023-02-08T15:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: retrieve access code automatically - javascript</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657915#M29958</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1569375"&gt;@env&lt;/a&gt; As Здравко noted, this error message is referring to specifying what account on the Business team to operate on behalf of. For reference, when using any "team scopes", the resulting access token is connected to an entire Dropbox Business team, not an individual account. So, when using a team-scoped access token to access user-specific endpoints, such as /2/users/get_current_account, you will need to specify which member of the team you want to operate on behalf of.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;To do this, you'd need to &lt;A href="https://www.dropbox.com/developers/documentation/http/teams#teams-member-file-access" rel="noopener noreferrer" target="_blank"&gt;specify the 'Dropbox-API-Select-User' header&lt;/A&gt; (or 'Dropbox-API-Select-Admin' as needed/desired). The value should be the &lt;CODE&gt;team_member_id&lt;/CODE&gt; for whichever member you wish to act on behalf of. (For example, you can find team member IDs by calling &lt;A href="https://www.dropbox.com/developers/documentation/http/teams#team-members-get_info" rel="noopener noreferrer" target="_blank"&gt;/2/team/members/get_info_v2&lt;/A&gt; or &lt;A href="https://www.dropbox.com/developers/documentation/http/teams#team-members-list" rel="noopener noreferrer" target="_blank"&gt;/2/team/members/list_v2&lt;/A&gt;[&lt;A href="https://www.dropbox.com/developers/documentation/http/teams#team-members-list-continue" rel="noopener noreferrer" target="_blank"&gt;/continue&lt;/A&gt;], or corresponding native method in an SDK.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Alternatively, if you just want to connect to a particular account, you can disable any team scopes and get a new access token/refresh token without them. The access token without the team scopes will be specific to the particular account, Business or not, and so will not require the additional header. You can find more information on scopes in &lt;A href="https://www.dropbox.com/lp/developers/reference/oauth-guide" rel="noopener noreferrer" target="_blank"&gt;the OAuth Guide&lt;/A&gt;.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dropbox does also offer an official Java SDK. You can find &lt;A href="https://github.com/dropbox/dropbox-sdk-java" target="_blank"&gt;the documentation and examples here&lt;/A&gt;. Both of these SDKs support offline access with refresh tokens for unattended long-term access.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To set the the 'Dropbox-API-Select-User' header in the JavaScript SDK, you would use &lt;A href="https://dropbox.github.io/dropbox-sdk-js/Dropbox.html" target="_blank"&gt;the 'selectUser' option on the Dropbox object&lt;/A&gt;. To se it with the Java SDK, you would use &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v5.4.3/com/dropbox/core/v2/DbxTeamClientV2.html#asMember(java.lang.String)" target="_self"&gt;DbxTeamClientV2.asMember&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 17:32:45 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/retrieve-access-code-automatically-javascript/m-p/657915#M29958</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-02-08T17:32:45Z</dc:date>
    </item>
  </channel>
</rss>

