简体   繁体   中英

Symantec End Point Manager API - Authentication issues

The following is my code:

import requests, json

proxyDict = {
    "http": "<proxy>",
}
base_url = "https://<host_IP>/sepm/api/v1/identity/authenticate"

# if output is required in JSON format
json_format = True

payload = {
    "username" : "<username_here>",
    "password" : "<password_here>",
    "domain" : ""
}

headers = {
    "Content-Type" : "application/json"
}

requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += 'HIGH:!DH:!aNULL' # necessary
r = requests.Session()      # Start session in order to store the SessionID Cookie
print json.dumps(payload)
r = requests.post(base_url, proxies=proxyDict, verify=False, headers=headers, data=json.dumps(payload))

strings = r.text
print strings

The SSL certificate has some errors, and I am hence using verify=False and DEFAULT_CIPHERS += 'HIGH:!DH:!aNULL'

The above code is inline with the documentation provided, but the server is refusing my auth request, with the following error:

{"errorCode":"400","errorMessage":"Invalid Username or Password"}

Before you jump the gun, I checked and rechecked my credentials, and then checked a couple of more times. my credentials are correct

Is there an error in what I am doing?

Additional info: SEPM Version: {"version":"12.1.6168.6000"}

Late to this party, but I was having the same issue with almost the although going about it a bit differently. SO, what my issue ended up being was the special characters in my password. The rest method that handles authentication on the Symantec manager side of things doesn't know how to handle certain special characters so it returns a 400 syntax error. Trying pulling special characters from you password, and keep it under 15 characters.

Good luck.

You might want to try putting the below line near the top of your code:

     urllib3.disable_warnings()

And ignore the SSL authentication

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM