Connecting to a session based AUTH

Hello,

I have an API that I want to connect too, but it uses a session based cookie. I've read the docs and tried to set something up, but I am not doing very well!

I have this implemented with my own api/node server, but I want to recreate it with Retool.

For context, this what I did in node and I want to create a resource the same way.

PBXInterface class

const axios = require('axios');
const user = 'XXXXX';
const password = 'XXXXXXXX';
const md5password = crypto.createHash('md5').update(password).digest('hex');
const baseUrl = 'https://admin.sipharmony.com/rest';

const axiosInstance = axios.create({
  baseURL: baseUrl,
  httpsAgent: new https.Agent({
    rejectUnauthorized: false,
  }),

//Acquiring and refresh are the same function.
exports.connect = async () => {
  return await axiosInstance
    .put(
      `${baseUrl}/system/session`,
      {
        name: 'auth',
        value: `${user} ${md5password}`,
      },
      { withCredentials: true }
    )
    .then((res) => {
      logger.info('Session token acquired!');
      axiosInstance.defaults.headers.Cookie = `session=${res.data}`;
      return axiosInstance;
    })
    .catch((error) => {
      logger.error(`Error acquiring session token!!`);
      throw new ApiError(httpStatus.INTERNAL_SERVER_ERROR, 'Error acquiring session token!')
    });
};

});

The cookie name is session=theCookie

Have you checked out this doc?

:flushed: looking now!