Lipper API - Token Errors

Hi, we receive different token errors when we want to extract data via API from Lipper: Token Error 400, Token Error 401, Token Error 403


Could you please explain what these errors mean? In all cases we get no data.

Tagged:

Best Answer

Answers

  • hi @maximilian.mayrl ,

    Could you please provide the code you use. (please also remove the credentials out of the code)

  • @maximilian.mayrl , Is this a trail license? If so, maybe you can check if it's trail period is expired. If it is a normal paid license, did that user recently added or modified his/her service subscription? I am using the RDP Funds API and I have no issue encountered today.

  • SCOPE = "trapi
    TOKEN_ENDPOINT = "https://api.refinitiv.com/auth/oauth2/v1/token"
    expires_at = time.time()

    auth_data = {"username": pen.settings.LIPPER_USERNAME, "password": pen.settings.LIPPER_PASSWORD, "grant_type": "password","scope": SCOPE, "takeExclusiveSignOnControl": "true"
    }

    refresh_data = {"refresh_token": lipper_refresh_token, "username": pen.settings.LIPPER_USERNAME, "grant_type": "refresh_token"
    }

    def get_token():
    global lipper_token, expires_at, lipper_refresh_token, rest_token_error_messages
    # global datascope_token
    if lipper_token == '' or expires_at < time.time():
    if lipper_refresh_token == '':
    respond = requests.post(TOKEN_ENDPOINT, headers = {"Accept": "application/json"}, data = auth_data, auth = (CLIENT_ID, CLIENT_SECRET))
    else:
    respond = requests.post(TOKEN_ENDPOINT, headers = {"Accept": "application/json"}, data = refresh_data, auth = (CLIENT_ID, CLIENT_SECRET))

    if respond.status_code != 200:
    return None
    else:
    respond_dict = respond.json()
    lipper_token = respond_dict['access_token']
    lipper_refresh_token = respond_dict['refresh_token']
    refresh_data['refresh_token'] = lipper_refresh_token
    expires_at = time.time() + int(respond_dict['expires_in']) - 10
    SCOPE = respond_dict['scope']
    auth_data['scope'] = SCOPE
    return lipper_token
  • Hi @raksina.samasiri
    There is the code we use for getting a token. It works without problems locally and only from time to time on the server.

  • @b.lee
    We have a normal paid license and the subscription user was not changed recently. The problem is that everything works just fine locally and not stable on the server. Sometimes we get Token Error 400 and 401 there.