Delete webhooks for revoked OAuth app

Description

Currently there's no way to delete a setup webhook when the user revokes the OAuth app.

Proposal

  1. Automatically delete webhooks attached to an account when the OAuth app is revoked/deleted.

OR

  1. Send a 410 Gone back to the server to delete the webhook, since the other side will receive an error when the credentials become invalid.

Links / references

Trello implements this beautiful way of handling webhooks deletion: https://developers.trello.com/apis/webhooks (See Deleting webhooks section)

Documentation blurb

  1. Why should someone use it; what's the underlying problem. The problem is that the system integrating through webhooks will get bloated with requests if a handful of users revoke their OAuth apps and they can't be deleted in any other way than using OAuth credentials.
  2. What is the solution.
  • GitLab's system should automatically delete webhooks attached to an account when the OAuth app is revoked/deleted.

OR

  • Send a 410 Gone back to the server to delete the webhook, since the other side will receive an error when the credentials become invalid.
  1. How does someone use this

When trying to respond back to GitLab, but we receive an unauthorized/unauthenticated error, we rescue from it and delete the webhook ( if the second solution is implemented, otherwise GitLab will take care of this 😄 )

Edited by 🤖 GitLab Bot 🤖