Default companion authentication not working?

Started by sonicviz2 replies1,087 views
sonicvizOriginal post
#1

I’m using the following on local host for prototyping.
It works, and googledrive and dropbox show aok in dashboard,
The first time I click on either of them it asks to authenticate and allow access, takes me to a page to do that, then goes reloads the page with:
Please authenticate with Google Drive to select files
or
Please authenticate with Dropbox to select files

But I received emails from both Google and Dropbox saying:
" Transloadit was granted access to your linked Google Account"
“You’ve connected a new app, ‘Transloadit Uppy Server’, to your Dropbox”

Then if I click Done, then try again, when you click on connect it just reloads the same page with the same message.

Is this a local development issue? (I don’t think it is, but…)

Code:
uppytl
.use(Uppy.Transloadit, {
params: {
auth: { key: TRANSLOADIT_EXAMPLE_KEY },
template_id: TRANSLOADIT_EXAMPLE_TEMPLATE
},
waitForEncoding: true,
})
.use(Uppy.Dashboard, {
inline: true,
maxHeight: 400,
target: ‘#uppy-dashboard-container’,
note: ‘Images and video only, 1–2 files, up to 1 MB’
})
.use(Uppy.GoogleDrive, {
target: Uppy.Dashboard,
companionUrl: Uppy.Transloadit.COMPANION
})
.use(Uppy.Dropbox, {
target: Uppy.Dashboard,
companionUrl: Uppy.Transloadit.COMPANION
})

ifedapoolarewaju
#2

Hi there, when using with Transloadit, you need to set the following option companionAllowedHosts: Uppy.Transloadit.COMPANION_PATTERN in your Provider plugin (i.e Dropbox, Instagram, etc.). So you’ll have soemthing like this:

uppytl
    .use(Uppy.Transloadit, {
        params: {
            auth: {
                key: TRANSLOADIT_EXAMPLE_KEY
            },
            template_id: TRANSLOADIT_EXAMPLE_TEMPLATE
        },
        waitForEncoding: true,
    })
    .use(Uppy.Dashboard, {
        inline: true,
        maxHeight: 400,
        target: '#uppy-dashboard-container',
        note: 'Images and video only, 1–2 files, up to 1 MB'
    })
    .use(Uppy.GoogleDrive, {
        target: Uppy.Dashboard,
        companionUrl: Uppy.Transloadit.COMPANION,
        companionAllowedHosts: Uppy.Transloadit.COMPANION_PATTERN
    })
    .use(Uppy.Dropbox, {
        target: Uppy.Dashboard,
        companionUrl: Uppy.Transloadit.COMPANION,
        companionAllowedHosts: Uppy.Transloadit.COMPANION_PATTERN
    })

By default this value is set to the value of companionUrl, but for the case of Transloadit, we need to set a Regex because any url instance (e.g instancex.transloadit.com, or instancey.transloadit.com) of transloadit may respond to your request. So setting the regex makes it allow any url from Transloadit.

sonicviz
#3

ok, thanks very much!