OAuth 2.0 - Invalid grant type or callback URL is not valid

Hi im trying to do Authorization code flow, where i want the user to log-in to page to read his data (in what guild he is and so on). The issue im currently having is that i followed the guildeline for OAuth from client side but unfortunatelly the api when redirected is returning: 400 Invalid grant type or callback URL is not valid..

Here is a snippet of my code where im redirecting:

const base = "https://oauth.battle.net/authorize?";
const authUrl = new URLSearchParams({
      region: 'eu',
      client_id: 'my_super_secret_code',
      response_type: 'code',
      grant_type: 'authorization_code',
      redirect_uri: 'http://localhost:5173/',
      state: 'TEST',
      scope: 'openid wow.profile'
    }).toString();

Have i missed anything? I have read teh docs but there is nothing more specified to this :face_with_spiral_eyes: please help.

Your redirect URL must use HTTPS. OAuth guide.

I hate tryed https localhost:port and its is the same :frowning:

your call back url must match the on in your access settings and these need to be https as well