Login API authentication failure

Hello Community,

I have been stuck with this failing API authentication call, I keep getting the exception error, I supplied the right variables and the authentications still keep failing not sure what I am doing wrong here. I am on dremio version 15 and connecting over a VPN, This API connection worked in the past. So confused on !

Any advanced inspection is greatly appreciated.

logger =logging.getLogger('dremioAPIcaller')


formatter =logging.Formatter('%(asctime)s-%(name)s -%(levelname)s-%(message)s')



username = os.getenv('dremio_username')
password = os.getenv('dremio_pwd')
headers = {'content-type':'application/json'}
dremioServer = os.getenv('dremioUrl')

def login_token(username, password):
    This will return login  authorizationlogin header
    :param usrname => this is user login id
    :param => pasword 
        loginData = {'userName': username, 'password': password}
        response = requests.post('http://{}/apiv2/login'.format(dremioServer), headers=headers, data=json.dumps(loginData))
        data = json.loads(response.text)
        # retrieve the login token
        token = data['token']
        return {'content-type':'application/json', 'authorization':'_dremio{authToken}'.format(authToken=token)}
        logger.debug('check your connection settings')
headers =login_token(username, password)

@iskidet Jus to narrow down the issue, if you login using the username/password that gets passed to your script but using the UI, does it work?

The credentials works perfectly when I login in the UI

@iskidet just change data=json.dumps(loginData) to json = loginData


Do you mean to say


I am wondering what get passed to token if I write


Just do:

response = requests.post('http://{}/apiv2/login'.format(dremioServer), headers=headers, json = loginData)

For some reason dremio can´t parse json object. Just check if you loginData looks like a python dict