Jump to content

regalia

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by regalia

  1. I have been encountering Error 403 when I attempt an API login using a RSA-encrypted password (a requirement for my region).

    I am using the Crypto library in Python, and while I have been able to obtain the encryptionKey and timestamp, the encrypted password does not seem to work. Relevant sections of the code reproduced hereunder. 

    Quote

     

    from Crypto.Cipher import PKCS1_OAEP
    from Crypto.PublicKey import RSA

    ... call GET to /session/encryptionKey and obtain "response"

        data = response.json() 
        key = RSA.import_key(base64.b64decode(data['encryptionKey']))
        cipher = PKCS1_OAEP.new(key)
        msg = config.password + "|" + str(data['timeStamp'])
        enc = base64.b64encode(cipher.encrypt(msg.encode('utf-8'))).decode('utf-8')

    ...

        header = {"Content-Type": "application/json; charset=utf-8", "Accept": "application/json; charset=utf-8", "X-IG-API-KEY": config.api_key, "Version": "2"}
        payLoad = {"identifier": config.username, "password": enc, "encryptedPassword": "True" }
          
        r = requests.post(url, payLoad, header)

     

     

    this will produce a HTTP 403 (Forbidden). Is there anything I am missing out or doing wrong?

×
×
  • Create New...
us