We're running two mattermost servers.
One we have a python process logging in with https://github.com/Vaelor/python-mattermost-driver using a personal access token with the community Python driver. This process has a session that doesn't time out which is one of the benefits of using a personal access token to login. https://docs.mattermost.com/developer/personal-access-tokens.html .
We log in using a username and password with the client4 go driver and this works however it times out after a while. It appears there is no way of using a personal access token to log in with the official client 4 driver.
The documentation for the Mattermost Client4 code is at https://godoc.org/github.com/mattermost/platform/model#Client
The source for client4 is at https://github.com/mattermost/mattermost-server/blob/master/model/client4.go
The closest thing that looks like it would work is logging in under with a username and password and then setting the authentication token via client.MockSession which failed on testing.
What's the official way of logging in with a personal access token using the client4 go driver for mattermost?
The key is not logging in, setting the personal access token and calling client.GetMe. This became clear after looking through the python driver source code. The relevant fragment is.
Context.