Setting up oauth API

my dashboard is hosted on https://cardinal.oreotm.xyz
and my backend is hosted on a vps on [ipaddress]

Backend Setup:
auth: {
            id: BotClientID,
            secret: envParseString('OAUTH_SECRET'),
            cookie: 'CARDINAL_AUTH', //envParseString('OAUTH_COOKIE'),
            redirect: 'https://cardinal.oreotm.xyz/oauth/discord/callback', // envParseString('OAUTH_REDIRECT_URI') 
            scopes: [OAuth2Scopes.Identify, OAuth2Scopes.Guilds],
            transformers: [transformOauthGuildsAndUser],
            domainOverwrite: '.oreotm.xyz' //envParseString('OAUTH_DOMAIN_OVERWRITE')
        },
        prefix: '/', //envParseString('API_PREFIX'),
        origin: 'https://cardinal.oreotm.xyz', //envParseString('API_ORIGIN'),
        listenOptions: {
            port: 4000
        }


Frontend Code:
const response = await fetch(`${BASE_CARDINAL_API_URL}/oauth/callback`, {
            method: 'POST',
            credentials: 'include',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({
                code,
                redirectUri: REDIRECT_URI
            })
        });


When i host the frontend on my local machine the login data is returned, but when i host the site on the domain it returns 'Bad request'. How do i properly set the api up?
Solution
something like
http://207.xxx.xxx.xxx:4000


could it be because im mixing http and https while using
credentials: 'include'
Was this page helpful?