<?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: View a file using a authentication token in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365616#M20743</link>
    <description>&lt;P&gt;Hello Greg&lt;/P&gt;&lt;P&gt;Yea.&amp;nbsp; Viewing it on the dropbox site is what I imagined.&amp;nbsp; Efectively a security layer between public and user login that uses credentails from a server rather than from the user. (A server request that generates a temporary link maybe?&amp;nbsp; Depends on how you want to handle it).&lt;/P&gt;&lt;P&gt;Thanks for the reply. For now ill just use the downloading function and ill keep an eye out for this as a feature for future projects.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Sep 2019 20:44:00 GMT</pubDate>
    <dc:creator>Alex-Mason-1982</dc:creator>
    <dc:date>2019-09-17T20:44:00Z</dc:date>
    <item>
      <title>View a file using a authentication token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365490#M20731</link>
      <description>&lt;P&gt;I have a general question.&amp;nbsp; Is it possible using the dropbox api to view a file using an authentication token rather than logging in?&lt;/P&gt;&lt;P&gt;I am creating a website that uses dropbox to store documents that are not for public viewing.&amp;nbsp; I dont want to enable link sharing (which I have done successfully already for something else) but i would like them to click a file and go and view it (using an athentication token that the server provides) rather than dowloading it (which ive also figured out).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ive had a look through the api but cant seem to find anything that fits the bill.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.npmjs.com/package/dropbox" target="_blank" rel="noopener"&gt;Dropbox in node (pretty sure this is the official dropbox node api)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;// UPLOAD CODE (working) //&lt;/P&gt;&lt;PRE&gt;import fetch from 'isomorphic-fetch';
import {Dropbox} from 'dropbox';
import {Meteor} from 'meteor/meteor';

import {
  FILE_UPLOAD,
  FILE_UPLOAD_ERROR,
  FILE_UPLOAD_SUCCESS,
} from '../../store/reducers/file/constants';

export default async function uploadFile(file, callback, data) {
  data.dispatch({type: FILE_UPLOAD, payload: true});
  Meteor.call('authDropbox', async function(error, result) {
    try {
      const dbx = new Dropbox({accessToken: result.token, fetch: fetch});
      const response = await dbx.filesUpload({
        contents: file, &lt;BR /&gt;        path: `/${data.location}/${file.name}`,
        mode: 'add',
        autorename: true,
        mute: true,
      });
      callback(response, data);
      data.dispatch({type: FILE_UPLOAD_SUCCESS});
    } catch (err) {
      data.dispatch({
        type: FILE_UPLOAD_ERROR,
        payload: err.message,
      });
    }
  });
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// DOWNLOAD CODE (working) //&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import fetch from 'isomorphic-fetch';
import {Dropbox} from 'dropbox';
import {Meteor} from 'meteor/meteor';
import {saveAs} from 'file-saver';

export default async function downloadFile(file) {
  Meteor.call('authDropbox', async function(error, result) {
    try {
      const dbx = new Dropbox({accessToken: result.token, fetch: fetch});
      const response = await dbx.filesDownload({path: file.path_display});
      saveAs(response.fileBlob, response.name);
    } catch (err) {
      console.log(err);
    }
  });
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// CREATE SHARING LINK (working) //&lt;/P&gt;&lt;PRE&gt;//this should be inserted in the upload code while authorised
const response = await dbx.sharingCreateSharedLink({
    path: `/${data.location}/${file.name}`
});
const sharingLink = response.url;  
//store sharing link somewhere i generaly do it in the callback&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 05:49:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365490#M20731</guid>
      <dc:creator>Alex-Mason-1982</dc:creator>
      <dc:date>2019-09-17T05:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: View a file using a authentication token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365560#M20736</link>
      <description>&lt;P&gt;Thanks for writing this up. The&amp;nbsp;Dropbox API doesn't offer anything quite like what you describe, but I'll be happy to pass this along as a feature request.&lt;/P&gt;
&lt;P&gt;To clarify a bit first though, do you mean that you would want the user to be able to go view the file on &lt;A href="http://www.dropbox.com" target="_blank"&gt;www.dropbox.com&lt;/A&gt; with&amp;nbsp;the&amp;nbsp;Dropbox file viewer web page like they would normally from the official Dropbox web site file listing, or do you just want a link that would return the file data directly, without the&amp;nbsp;Dropbox file viewer web page?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 15:07:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365560#M20736</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-09-17T15:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: View a file using a authentication token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365616#M20743</link>
      <description>&lt;P&gt;Hello Greg&lt;/P&gt;&lt;P&gt;Yea.&amp;nbsp; Viewing it on the dropbox site is what I imagined.&amp;nbsp; Efectively a security layer between public and user login that uses credentails from a server rather than from the user. (A server request that generates a temporary link maybe?&amp;nbsp; Depends on how you want to handle it).&lt;/P&gt;&lt;P&gt;Thanks for the reply. For now ill just use the downloading function and ill keep an eye out for this as a feature for future projects.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 20:44:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365616#M20743</guid>
      <dc:creator>Alex-Mason-1982</dc:creator>
      <dc:date>2019-09-17T20:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: View a file using a authentication token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365621#M20744</link>
      <description>&lt;P&gt;Thanks for clarifying!&amp;nbsp;I'm sending this along as a feature request, though I can't promise if or when that might be implemented.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 21:10:31 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/View-a-file-using-a-authentication-token/m-p/365621#M20744</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-09-17T21:10:31Z</dc:date>
    </item>
  </channel>
</rss>

