mattermost / mattermost-plugin-google-calendar

Mattermost Google Calendar Plugin
34 stars 35 forks source link

Can't link calendar because it was previously linked to removed mattermost account #87

Closed dobriyprop closed 1 month ago

dobriyprop commented 2 months ago

Hi! I have an issue linking my Google Calendar to the plugin after the administrator had to remove and re-create my Mattermost account. After i authorize with my Google Account with /gcal connect it gives me the following error {"error":"Google Calendar account '<account name>' is already mapped to a Mattermost account, but the Mattermost user could not be found","details":"Unauthorized."} Is there any way to make plugin forget the integration with previously removed Mattermost account?

fmartingr commented 2 months ago

Hey @dobriyprop, did you try to go to your Google Admin Console and manually deleting the Mattermost Google Calendar Plugin ? That should remove the subscription from the Google servers and you should be able to connect to your account again.

If that does not work, some manual database queries are required to manually remove user data from the plugin storage. I'm thinking ways to automate this so no user interaction is needed, but there's nothing ready right now.

dobriyprop commented 2 months ago

I removed the integration from Security Settings page of my corporate Google Account, but to no awail. Seems like the issue sits in the plugin's database since it says that it has this Google Account mapped to another Mattermost account, which no longer exists. Ok, i'm gonna ask system administrator who deployed Mattermost if he can access the database and do manual alterations in attempt to fix the issue. Can you give us a hint where this data is being stored so we could locate it quicker?

I'm thinking ways to automate this so no user interaction is needed

That would be great!

fmartingr commented 1 month ago

Some quick things that come to mind to manually address this:

In the table PluginKeyValueStore there would be a row where pluginId = com.mattermost.gcal and pkey = user_<your old mattemost user id> There should be another one pluginId = com.mattermost.gcal and key = psub_<your google user id>

My guess is that the last one is the problematic one, but both can be deleted.

Let me know if this helps.

dobriyprop commented 1 month ago

Thanks, but i was told just now that we're are gonna reset whole mattermost server completely since this deployment was for evaluation purposes. I guess after complete redeployment this won't be an issue anymore. Anyway, thanks for your support!