# 401 Unauthorized after login with Instagram

**URL:** <https://community.transloadit.com/t/401-unauthorized-after-login-with-instagram/14995>\
**Category:** Uppy\
**Created:** [July 30, 2019, 7:51pm UTC](https://community.transloadit.com/t/401-unauthorized-after-login-with-instagram/14995 "2019-07-30T19:51:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucascrocha1](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lucascrocha1](https://community.transloadit.com/u/lucascrocha1)\
**Post date:** [July 30, 2019, 7:51pm UTC](https://community.transloadit.com/t/401-unauthorized-after-login-with-instagram/14995/1 "2019-07-30T19:51:59Z")

</div>

Hello,

I’m trying to use instagram with Uppy and Companion.

I followed this [example](https://github.com/transloadit/uppy/tree/master/examples/uppy-with-companion) to use Companion and Uppy.

This is the code from the server:

```
const env = require('./src/env/env');
const options = require('./src/uppy/uppy')();
const express = require('express');
const session = require('express-session');
const bodyParser = require('body-parser');
const companion = require('@uppy/companion');

const app = express();

app.use(bodyParser.json());

app.use(session({
    secret: env.secret,
    resave: true,
    saveUninitialized: true
}));

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

    next();
});

app.get('/', (req, res) => {
    res.setHeader('Content-Type', 'text/plain')
    res.send('Up and running!');
});

app.use(companion.app(options));

companion.socket(app.listen(env.port), options);

console.log("Up and running at: " + env.url);

```

This is the options:

```
providerOptions: {
        // google: {
        // key: env.googleDrive.key,
        // secret: env.googleDrive.secret
        // },
        instagram: {
            key: env.instagram.key,
            secret: env.instagram.secret
        },
    },
    server: {
        host: env.url,
        protocol: 'http'
    },
    filePath: env.filePath,
    secret: env.uppy.secret,
    debug: env.isDebug,
    sendSelfEndpoint: env.url

```

This is the client code:

```
let uppy = this.Uppy.Core({
        autoProceed: false,
        allowMultipleUploads: false,
        inline: true,
        debug: true
    })
    .use(this.Uppy.Dashboard, {
        inline: true,
        target: '#t-imagem-content'
    })
    .use(this.Uppy.Instagram, {
        target: this.Uppy.Dashboard,
        companionUrl: 'http://localhost:4333',
    })
    .use(this.Uppy.XHRUpload, {
        endpoint: 'https://localhost:44304/api/Settings/UploadProfile',
        method: 'post',
        formData: true,
        fieldName: 'file'
    });    

```

When i click on the button to connect to Instagram, i can do the login, but when it redirects to the send-token url with the uppy auth token, i get the 401 Unauthorized page

---

<div class="post-metadata">

**Author:** ![ajkachnic](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/ajkachnic/32/260_2.png) [@ajkachnic](https://community.transloadit.com/u/ajkachnic)\
**Post date:** [July 17, 2020, 1:10pm UTC](https://community.transloadit.com/t/401-unauthorized-after-login-with-instagram/14995/2 "2020-07-17T13:10:38Z")

</div>

Hello! There is a good chance that [this forum post](https://community.transloadit.com/t/instagram-plugin-401-unauthorized/15078) resolves your issue

If it doesn’t, please let me know

- Andrew
