Error on OAuth Connect

I’m having an issue when trying to use OAuth to connect to Dropbox or Google Drive. It gets through the process of going to Google or Dropbox, asking for the user’s consent, then redirects back to my website and shows the error. I’ve searched and tried different ideas for a couple of hours and can’t seem to get to the bottom of it. Anyone have any ideas?

Companion was unable to complete the OAuth process :frowning:
Error: User session is missing or the Provider was misconfigured

Companion log shows this:

companion: 2019-11-20T00:35:03.975Z [error] grant.oauth.error grant.js responded with error: error=Grant%3A%20missing%20session%20or%20misconfigured%20provider

companion server:

#!/usr/bin/env node

const fs = require('fs')
const path = require('path')
const companion = require('@uppy/companion')
const app = require('express')()

const DATA_DIR = path.join(__dirname, 'tmp')

app.use(require('body-parser').json())
app.use(require('express-session')({
  secret: 'XXXX',
  resave: false,
  saveUninitialized: false,
}))

app.use((req, res, next) => {
  res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*')
  res.setHeader(
    'Access-Control-Allow-Methods',
    'GET, POST, OPTIONS, PUT, PATCH, DELETE'
  )
  res.setHeader(
    'Access-Control-Allow-Headers',
    'Authorization, Origin, Content-Type, Accept'
  )
  next()
})

const options = {
  providerOptions: {
    dropbox: {
      key: 'XXXX',
      secret: 'XXXX'
    },
    google: {
      key: 'XXXX',
      secret: 'XXXX'
    },
    s3: {
      getKey: (req, filename) =>
        `XXXX/${filename}`,
      key: "XXXX",
      secret: "XXXX",
      bucket: "XXXX",
      region: "us-west-2"
    }
  },
  server: { host: 'XXXX.dxe.io', path: '/uploader/companion', protocol: 'https' },
  filePath: DATA_DIR,
  sendSelfEndpoint: "XXXX.dxe.io/uploader/companion",
  secret: 'XXXX',
  debug: true
}

app.use(companion.app(options))

const server = app.listen(3020, () => {
  console.log('listening on port 3020')
})

companion.socket(server, options)

client:

const Uppy = require('@uppy/core')
const Dashboard = require('@uppy/dashboard')
const AwsS3 = require('./vendor/@uppy/aws-s3')
const Dropbox = require('@uppy/dropbox')
const GoogleDrive = require('@uppy/google-drive')

const uppy = Uppy()
	.use(Dashboard, {
        inline: true,
        target: '#drag-drop-area',
        proudlyDisplayPoweredByUppy: false,
        showLinkToFileUploadResult: false
    })
	.use(AwsS3, {
	  limit: 2,
	  companionUrl: 'https://XXXX.dxe.io/uploader/companion'
	})
	.use(Dropbox, {
	  target: Dashboard,
	  companionUrl: 'https://XXXX.dxe.io/uploader/companion'
	})
	.use(GoogleDrive, {
	  target: Dashboard,
	  companionUrl: 'https://XXXX.dxe.io/uploader/companion'
	})

uppy.on('file-added', async (file) => {
  console.log('Added file', file)
  console.log(uppy.getState())
})