I am trying to connect to OPC UA with only username and password. I am using library for Python asyncua version 1.0.4
Below part snip of my code:
async with Client(url=self._url, timeout=2) as client: # client.activate_session(username="guest", password="guest") await client.set_user("guest") await client.set_password("guest") I have checked different option but getting still error: The user identity token is not valid.(BadIdentityTokenInvalid)
UaExpert is connecting with username and password without any problems.
Could anyone advise me what am I doing wrong?
Thank you
1 Answer
You are connecting to the server before setting the password, change your code to this:
client = Client(url=self._url, timeout=2) client.set_user("guest") client.set_password("guest") async with client : # Do your sutff 0