<?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: Salesforce - Dropbox API Connection in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Salesforce-Dropbox-API-Connection/m-p/695038#M31098</link>
    <description>&lt;P&gt;Здравко is correct. I would suggest following his guidance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, you shared your access token, I went ahead and redacted that information.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2023 13:34:39 GMT</pubDate>
    <dc:creator>DB-Des</dc:creator>
    <dc:date>2023-06-28T13:34:39Z</dc:date>
    <item>
      <title>Salesforce - Dropbox API Connection</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Salesforce-Dropbox-API-Connection/m-p/694929#M31093</link>
      <description>&lt;P&gt;Please help me regarding integration between dropbox and salesforce ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get user details from dropbox and display it in salesforce.&lt;/P&gt;&lt;P&gt;Another requirement is, upload files from salesforce and upload it in dropbox . and get the files or images from dropbox and display it in &lt;A href="https://www.edureka.co/salesforce-administrator-and-developer-training" target="_self"&gt;salesforce&lt;/A&gt;....&lt;/P&gt;&lt;P&gt;I have access token ,api key, api secret all things , but I don't know how pass request and how to get response as user details.&lt;/P&gt;&lt;P&gt;In below Code ... in system debug I m getting&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;{ access_token":"REDACTED", "token_type": "bearer", "uid": "328256643"}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But in system.debug of Account Information, I m getting following error- Account Information ::&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;{"error": "OAuth 2 \"Authorization\" header is not well-formed."}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Below is Apex Class:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;public&lt;/SPAN&gt; &lt;SPAN class=""&gt;class&lt;/SPAN&gt; &lt;SPAN class=""&gt;DropboxController&lt;/SPAN&gt;
{

    &lt;SPAN class=""&gt;//Fetched from URL&lt;/SPAN&gt;
    String code ;
    String accesstoken;
    &lt;SPAN class=""&gt;public&lt;/SPAN&gt; &lt;SPAN class=""&gt;DropboxController&lt;/SPAN&gt;&lt;SPAN class=""&gt;()&lt;/SPAN&gt;
    {
        code = ApexPages.currentPage().getParameters().get(&lt;SPAN class=""&gt;'code'&lt;/SPAN&gt;) ;
        &lt;SPAN class=""&gt;//Get the access token once we have code&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;if&lt;/SPAN&gt;(code != &lt;SPAN class=""&gt;''&lt;/SPAN&gt; &amp;amp;&amp;amp; code != &lt;SPAN class=""&gt;null&lt;/SPAN&gt;)
        {  
           AccessToken() ;
        }    

    }

    &lt;SPAN class=""&gt;public&lt;/SPAN&gt; PageReference &lt;SPAN class=""&gt;DropAuth&lt;/SPAN&gt;&lt;SPAN class=""&gt;()&lt;/SPAN&gt;
    {
        &lt;SPAN class=""&gt;//Authenticating&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;PageReference&lt;/SPAN&gt; &lt;SPAN class=""&gt;pg&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;PageReference&lt;/SPAN&gt;(&lt;SPAN class=""&gt;'https://www.dropbox.com/1/oauth2/authorize?response_type=code&amp;amp;client_id=nw7mfi19tfaxak8&amp;amp;redirect_uri=https://c.ap2.visual.force.com/apex/Dropbox&amp;amp;state=Mytesting'&lt;/SPAN&gt;) ;
        &lt;SPAN class=""&gt;return&lt;/SPAN&gt; pg ;
    }

    &lt;SPAN class=""&gt;public&lt;/SPAN&gt; &lt;SPAN class=""&gt;void&lt;/SPAN&gt; &lt;SPAN class=""&gt;AccessToken&lt;/SPAN&gt;&lt;SPAN class=""&gt;()&lt;/SPAN&gt;
    {
        &lt;SPAN class=""&gt;//Getting access token from dropbox&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;String&lt;/SPAN&gt; &lt;SPAN class=""&gt;tokenuri&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;'https://api.dropbox.com/1/oauth2/token?grant_type=authorization_code&amp;amp;code='&lt;/SPAN&gt;+code+&lt;SPAN class=""&gt;'&amp;amp;redirect_uri=https://c.ap2.visual.force.com/apex/Dropbox'&lt;/SPAN&gt;; 
        &lt;SPAN class=""&gt;HttpRequest&lt;/SPAN&gt; &lt;SPAN class=""&gt;req&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;HttpRequest&lt;/SPAN&gt;();
        req.setEndpoint(tokenuri);
        req.setMethod(&lt;SPAN class=""&gt;'POST'&lt;/SPAN&gt;);
        req.setTimeout(&lt;SPAN class=""&gt;60&lt;/SPAN&gt;*&lt;SPAN class=""&gt;1000&lt;/SPAN&gt;);

        &lt;SPAN class=""&gt;Blob&lt;/SPAN&gt; &lt;SPAN class=""&gt;headerValue&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; Blob.valueOf(&lt;SPAN class=""&gt;'nw7mfi19tfaxak8'&lt;/SPAN&gt; + &lt;SPAN class=""&gt;':'&lt;/SPAN&gt; + &lt;SPAN class=""&gt;'REDACTED'&lt;/SPAN&gt;);
        &lt;SPAN class=""&gt;String&lt;/SPAN&gt; &lt;SPAN class=""&gt;authorizationHeader&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;'BASIC '&lt;/SPAN&gt; + EncodingUtil.base64Encode(headerValue);
        req.setHeader(&lt;SPAN class=""&gt;'Authorization'&lt;/SPAN&gt;, authorizationHeader);
        &lt;SPAN class=""&gt;Http&lt;/SPAN&gt; &lt;SPAN class=""&gt;h&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;Http&lt;/SPAN&gt;();
        String resp;
        &lt;SPAN class=""&gt;HttpResponse&lt;/SPAN&gt; &lt;SPAN class=""&gt;res&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; h.send(req);
        resp = res.getBody();

        &lt;SPAN class=""&gt;JSONParser&lt;/SPAN&gt; &lt;SPAN class=""&gt;parser&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; JSON.createParser(resp);
        &lt;SPAN class=""&gt;while&lt;/SPAN&gt; (parser.nextToken() != &lt;SPAN class=""&gt;null&lt;/SPAN&gt;) {
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt; ((parser.getCurrentToken() == JSONToken.FIELD_NAME)){
                &lt;SPAN class=""&gt;String&lt;/SPAN&gt; &lt;SPAN class=""&gt;fieldName&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; parser.getText();
                parser.nextToken();
                &lt;SPAN class=""&gt;if&lt;/SPAN&gt;(fieldName == &lt;SPAN class=""&gt;'access_token'&lt;/SPAN&gt;) {
                    accesstoken = parser.getText();
                } 
            }
        }
        system.debug(&lt;SPAN class=""&gt;'accessToken==&amp;gt;'&lt;/SPAN&gt;+accessToken );
        System.debug(&lt;SPAN class=""&gt;' You can parse the response to get the access token ::: '&lt;/SPAN&gt; + resp);

        &lt;SPAN class=""&gt;string&lt;/SPAN&gt; &lt;SPAN class=""&gt;token&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;'https://api.dropbox.com/1/account/info'&lt;/SPAN&gt;;
        &lt;SPAN class=""&gt;HttpRequest&lt;/SPAN&gt; &lt;SPAN class=""&gt;r&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;HttpRequest&lt;/SPAN&gt;();
        r.setEndpoint(token);
        r.setHeader(&lt;SPAN class=""&gt;'Authorization'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;'Bearer'&lt;/SPAN&gt; +accesstoken);
        r.setMethod(&lt;SPAN class=""&gt;'GET'&lt;/SPAN&gt;);
        r.setTimeout(&lt;SPAN class=""&gt;60000&lt;/SPAN&gt;);
        &lt;SPAN class=""&gt;Http&lt;/SPAN&gt; &lt;SPAN class=""&gt;h1&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;Http&lt;/SPAN&gt;();
        &lt;SPAN class=""&gt;HttpResponse&lt;/SPAN&gt; &lt;SPAN class=""&gt;res1&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; h1.send(r);
        &lt;SPAN class=""&gt;string&lt;/SPAN&gt; &lt;SPAN class=""&gt;resp1&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; res1.getBody();

        System.debug(&lt;SPAN class=""&gt;' Account Information :: '&lt;/SPAN&gt; + resp1);
   }
}&lt;/PRE&gt;&lt;P&gt;As I am new to integration any help will be grateful...&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 10:35:04 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Salesforce-Dropbox-API-Connection/m-p/694929#M31093</guid>
      <dc:creator>sarfaraz_k</dc:creator>
      <dc:date>2023-07-04T10:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Salesforce - Dropbox API Connection</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Salesforce-Dropbox-API-Connection/m-p/695014#M31095</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1719039"&gt;@sarfaraz_k&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;But in system.debug of Account Information, I m getting following error- Account Information ::&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;{"error": "OAuth 2 \"Authorization\" header is not well-formed."}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;...&lt;/P&gt;&lt;PRE&gt;...
        &lt;SPAN class=""&gt;string&lt;/SPAN&gt; &lt;SPAN class=""&gt;token&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;'https://api.dropbox.com/1/account/info'&lt;/SPAN&gt;;
        &lt;SPAN class=""&gt;HttpRequest&lt;/SPAN&gt; &lt;SPAN class=""&gt;r&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;HttpRequest&lt;/SPAN&gt;();
        r.setEndpoint(token);
        r.setHeader(&lt;SPAN class=""&gt;'Authorization'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;'Bearer'&lt;/SPAN&gt; +accesstoken);
        r.setMethod(&lt;SPAN class=""&gt;'GET'&lt;/SPAN&gt;);
&lt;BR /&gt;...&lt;/PRE&gt;&lt;P&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/1719039"&gt;@sarfaraz_k&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Take in mind that 'Authorization' header' value should contain its type and the value. These are 2 different things that have to stay different (i.e. with separator between). As far as can be seen you have stick them together. That's why the format doesn't go well. &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; To avoid such mistakes use some of the official SDKs or prototype your calls using &lt;A href="https://dropbox.github.io/dropbox-api-v2-explorer/" target="_blank" rel="noopener"&gt;API explorer&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;By the way you're using unsupported call; better use &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#users-get_current_account" target="_blank" rel="noopener"&gt;2/users/get_current_account&lt;/A&gt;, for instance.&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 13:00:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Salesforce-Dropbox-API-Connection/m-p/695014#M31095</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2023-06-28T13:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Salesforce - Dropbox API Connection</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Salesforce-Dropbox-API-Connection/m-p/695038#M31098</link>
      <description>&lt;P&gt;Здравко is correct. I would suggest following his guidance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, you shared your access token, I went ahead and redacted that information.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 13:34:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Salesforce-Dropbox-API-Connection/m-p/695038#M31098</guid>
      <dc:creator>DB-Des</dc:creator>
      <dc:date>2023-06-28T13:34:39Z</dc:date>
    </item>
  </channel>
</rss>

