Open stshelton opened 6 years ago
Hi! could you please contact the Onfido support team at api@onfido.com? Could you also please give us more details on how you are downloading the documents? (i.e. the request that you sent to the Onfido API) Best regards
The error is still there. Didn't no one try to download files for more than a year? Here's an example code:
const Onfido = require('onfido');
var fs = require('fs');
const secret = fs.readFileSync('config/onfido_token.txt', 'utf8');
const defaultClient = Onfido.ApiClient.instance;
const tokenAuth = defaultClient.authentications['Token'];
tokenAuth.apiKey = 'token='+secret;
tokenAuth.apiKeyPrefix = 'Token';
const api = new Onfido.DefaultApi();
const document = await api.downloadDocument('INSERT applicantId HERE', 'INSERT documentId HERE');
It will give an error:
ReferenceError: File is not defined
at exports.downloadDocumentWithHttpInfo (/private/var/www/onfido-backuper/node_modules/onfido/src/api/DefaultApi.js:406:24)
at exports.downloadDocument (/private/var/www/onfido-backuper/node_modules/onfido/src/api/DefaultApi.js:422:19)
...
In DefaultApi.js you can see:
var authNames = ['Token'];
var contentTypes = [];
var accepts = ['*/*', 'application/json'];
var returnType = File; // <------------ there an unknown variable is referenced
return this.apiClient.callApi(
'/applicants/{applicant_id}/documents/{document_id}/download', 'GET',
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
When using var returnType = 'Blob';
it works as it should.
Currently using firebase's node js cloud servers and want to download images of documents to my own storage to later show user. Yet when I try to download the image from onfido js-client I get an error saying "File is not defined". Any idea why? I am new to node.js and backend should I be parsing the return object to a certain type of file ??