@uppy/companion
Version:
OAuth helper and remote fetcher for Uppy's (https://uppy.io) extensible file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox and Google Drive, S3 and more :dog:
23 lines (22 loc) • 748 B
JavaScript
;
const { respondWithError } = require('../provider/error');
async function deauthCallback({ body, companion, headers }, res, next) {
// we need the provider instance to decide status codes because
// this endpoint does not cater to a uniform client.
// It doesn't respond to Uppy client like other endpoints.
// Instead it responds to the providers themselves.
try {
const { data, status } = await companion.provider.deauthorizationCallback({
companion,
body,
headers,
});
res.status(status || 200).json(data);
}
catch (err) {
if (respondWithError(err, res))
return;
next(err);
}
}
module.exports = deauthCallback;