Invalid Refresh Token

@TomScott I tried both. I assume if it was missing the params I would get a different error?

I also tried directly from POSTMAN and I get the same error.

Full Note.js code:

            //is it time?
            const settings_keap_access = await Settings.readSetting({name: 'KEAP_ACCESS_TOKEN'});
            const settings_keap_refresh = await Settings.readSetting({name: 'KEAP_REFRESH_TOKEN'});
            
            if (moment(settings_keap_access.ext_next_check) < moment()) {

                const url = "https://api.infusionsoft.com/token";
                
                const data = qs.stringify({
                    client_id: process.env.KEAP_CLIENT_ID,
                    client_secret: process.env.KEAP_CLIENT_ID,
                    grant_type: "refresh_token",
                    refresh_token: settings_keap_refresh.value
                });

                const config = {
                    headers: {
                        "Authorization": `Basic ${base64(process.env.KEAP_CLIENT_ID + ':' + process.env.KEAP_CLIENT_ID)}`,
                        'Content-Type': 'application/x-www-form-urlencoded'
                    },
                };


                try {

                    const response = await axios.post(url, data, config)
                    if (response.status === 200) {

                        await Settings.updateSetting({value: response.data.refresh_token}, {name: 'KEAP_REFRESH_TOKEN'});
                        await Settings.updateSetting({value: response.data.access_token, ext_next_check: moment().add(21, 'hours').format(process.env.DATE_FORMAT)}, {name: 'KEAP_ACCESS_TOKEN'});
                        logger.log('success', 5, 'keap', `New Access Token: ${response.data.access_token}`, {})
                        return true

                    } else {
                        logger.log('error', 9, 'keap', `Failed to refresh tokens`, {
                            url: url,
                            config: config,
                            response: {
                                status: response.status,
                                data: response.data
                            }
                        })

                        return false
                    }

                }
                catch (e) {
                    logger.log('error', 9, 'keap', `Error updating access token`, {
                        url: url,
                        config: config,
                        error: {
                            name: e.name ? e.name : ' ',
                            message: e.message ? e.message : ' ',
                            response: e.response ? {
                                status: e.response.status ? e.response.status : ' ',
                                data: e.response.data ? e.response.data : ' ',
                            } : ' '
                        },
                    })
                    return false
                }

            }