InvalidCredentials, this error appears only with some users and it is confirmed that the credentials are correct
def Login():
if request.method=="POST":
login = request.form
username= login['username']
password = login['password']
if not '@example.com' in username:
u = username + '@example.com'
#else:
#u=username.lower()
# AD-Server connection
server = "xxxxxxxxxxxxx"
getserverInfo = Server(server, get_info=ALL)
`` try: c=Connection(getserverInfo, user=u,password=password,auto_bind=True) except Exception as e: print(e)
this might be a result of policies in your domain. it's unclear if you're using ldaps/startTLS, and it looks like you're using simple binds rather than SASL
some users in your domain might be restricted to either only binding over TLS-secured connections. some users also might not be allowed to login via username/password over LDAP, they might be required to use Kerberos or another SASL mechanism. there can also be different restrictions based on where a login comes from
unfortunately, the domain won't always give great information about why it failed the bind. you could try checking with your AD admin about policies there