ERROR: can't decrypt token unpad error. This could happen when incorrect encryption key is used
#250 opened on Jul 1, 2021
Repository metrics
- Stars
- (151 stars)
- PR merge metrics
- (PR metrics pending)
Description
Hello, I was setting up the plugin and everything worked fine. Then I've accidentally started the Mattermost server instance and lost the whole configuration and now I am setting it up from the ground again.
I am guessing, that some settings have persisted in the database, since I am receiving following error:
{"level":"error","ts":1625153373.8097563,"caller":"mlog/sugar.go:25","msg":"can't decrypt token","plugin_id":"com.github.manland.mattermost-plugin-gitlab","err":"unpad error. This could happen when incorrect encryption key is used"}
I guess it is this line: https://github.com/mattermost/mattermost-plugin-gitlab/blob/bb1e4fb115fc44a58ec2a5419c1140c32ff76dea/server/plugin.go#L163
I have tried following:
- uninstalling plugin & installing plugin
- resetting all settingssettings in Pugins -> GitLab
- removing all old webhooks in self-hosted GitLab
Now, the GitLab part is OK:

Problem is on the Mattermost side. Following "Unknown Error" is after /gitlab me or /gitlab disconnect:

mmctl version
mmctl v5.35.0 -- a2fb3f6d9bb3851fa52f692718a93403c99e32be
mmctl plugin list
WARNING: server version 5.36.1.5.36.1.f8c5c7e436d1d06ba4bbb0d689fe6931.false doesn't match mmctl version 5.35.0
Listing enabled plugins
com.github.manland.mattermost-plugin-gitlab: GitLab, Version: 1.3.0
Any ideas how can I update the encryption key in the Mattermost or mattermost-plugin-gitlab?
I guess, that after changing settings in /opt/mattermost/config/config.json:
{
"Plugins": {
"com.github.manland.mattermost-plugin-gitlab": {
"enableprivaterepo": true,
"encryptionkey": "secret-JYEvKxhnAzsDA",
"gitlabgroup": null,
"gitlaboauthclientid": "secret-3c1112b3d333093f72f164111f1042c6629cde1",
"gitlaboauthclientsecret": "secret-6e612216d6485998ed3378dc11fac81134",
"gitlaburl": "https://git.domain",
"webhooksecret": "secret-mOBHCPtws2cANGuf"
}
},
}
The database is not updated. Is there any way how to trigger it?
EDIT: Just asked a colleague who have not did have Mattermost GitLab plugin integration (/gitlab connect) and it is working for him. Therefore, there are probably some remedies for my original account, since when I am doing /gitlab me I am getting Unknown Error as was screenshoted above.
Is there a way how can I disconnect bot for my account? /gitlab disconnect yields the same problem.