I have Gitlab on one side, which serves me as an authentication provider.
I have Mattermost on the other side, with which I would use the API, to automatically save commands.
Finally, I have a Flask server (python) which is used to execute commands.
To save a single command, I go through the Mattermost interface, manually configuring the command.
Only, I will have several orders in the near future, and I would like to save them automatically. I already know what queries I have to perform for this (https://github.com/mattermost/platform/blob/master/api/command.go#L47).
What I have trouble with is the authentication of the Flask server in Mattermost.
If I understood everything, I must have a user token in Gitlab. I created it via Profile Settings> Access Tokens.
Only, when I run my queries on the Mattermost API with this token, Mattermost does not recognize it.
For example :
It works, I get list of all gitlab projects
Curl - header “PRIVATE-TOKEN: myTokenABCD” “https://gitlab.mydomain.com/api/v3/projects”
I have a message that my session is invalid or expired
Curl - header “Authorization: Bearer myTokenABCD” “https://mattermost.mydomain.com/api/v3/users/me”
So I do not understand how to properly authenticate to Mattermost via a gitlab token. And so I can not continue my program further.
Thank you all for reading!