An access token generated once in the morning should be valid for rest of the day. However, when an order for a new position is sent, the access token becomes invalid. For instance, I got the following error yesterday - <?xml version="1.0" encoding="UTF-8"?>\nInvalidArgumentUnsupported Authorization TypeAuthorizationtoken 2lm5dfck4x41p6y6:sSQ5zmqX68biE0pa4pRkI8Ri15df6W88XS1H3PHA5X7B8WNHtoBSlaL8enn5t9KJmfZUPgulos08odzJHpJHub+0nT1BqBZ9V0Wk8e/5FsibAuQEhUH5gsEQYJ0=
The above error occurred when an order for a new position was sent. Prior to this, multiple orders to close existing positions were sent and they went through fine with the same access token. But, when an order for a new position was sent, the access token became invalid and I had to generate a new access token to continue connecting to the api.
attaching screenshot for reference
ChatGPT tells me this -
I think the most likely reason is point 4. The server invalidated the access token which had to be generated again.
Using python client, The program will succeed if re-run for a couple of times after some time interval like a minute or two. This should have been server side issue, because I am using the same access_token.
DataException: Unknown Content-Type (application/xml) with response: (b'<?xml version="1.0" encoding="UTF-8"?>\n
InvalidArgumentUnsupported Authorization TypeAuthorizationtoken *ACTUAL TOKEN THAT WORKED AND WORKS AGAIN* *REQ ID**HOST ID*')