Vaelor/python-mattermost-driver

is it possible to allow login through a bot token instead of a personal access token?

Closed this issue · 5 comments

is it possible to allow login through a bot token instead of a personal access token?

I have the same question. When I use a bot token to login, I get mattermostdriver.exceptions.NoAccessTokenProvided: Invalid or expired session, please login again.

url = '<url>'
login_id = '<login>'
self._driver = Driver({
    'url': url,
    'login_id': login_id,
    'password': '',
    'token': '<token>',
    'scheme': 'https',
    'port': 443,
    'basepath': '/api/v4',
    'verify': True,
    'auth': None,
    'timeout': 30,
    'request_timeout': None,
    'debug': False
})

self._register_callback = register_callback

log.info(f'Logging in on {url} as {login_id}')
self._driver.login()

Works for me

Like @ritelle says, it should work - did you use the name/id of the access token by accident?

If you create the bot account you are given this text:

Setup Successful
Your bot account foo has been created successfully. Please use the following access token to connect to the bot (see documentation for further details).

Token: 6w8wwi967pgg7j8ykk3p8foqsa

You need to copy that token. The one in the overview for the bot accounts you can only see the token ID, which is NOT the same. If you did not copy the token, you have to create a new one for the bot account

@Vaelor looks like you were correct, I was given the wrong bot token. Just tried again with a new bot token and it works. Thanks!

@kziame175 no problem, glad to help!