|
| 1 | +--- |
| 2 | +title: Webhook Security |
| 3 | +sidebar_label: Webhook Security |
| 4 | +slug: /webhook-security |
| 5 | +--- |
| 6 | + |
| 7 | +This page guides you through the steps of adding an additional layer of security |
| 8 | +to your webhook. |
| 9 | + |
| 10 | +## Adding a Webhook Authentication Method |
| 11 | + |
| 12 | +In your OpenFn projects, you can utilize webhooks to receive data from external |
| 13 | +applications using a |
| 14 | +[Webhook Trigger](../build/triggers.md). When using a |
| 15 | +webhook, you can require external applications to authenticate before sending |
| 16 | +your project data for more security. |
| 17 | + |
| 18 | +OpenFn supports Basic HTTP Authentication using username and password, and API |
| 19 | +Key Authentication using the `x-api-key` request header. |
| 20 | + |
| 21 | +### Adding Authentication Via `Project Settings` |
| 22 | + |
| 23 | +You can add a new Authentication Method under `Webhook Security` of your |
| 24 | +`Project Settings`. The authentication you set up here can then be used in any |
| 25 | +of your Workflows within this Project. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +After clicking `New auth method`, choose the type - Basic HTTP or API Key |
| 30 | +Authentication. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +#### Basic Auth |
| 35 | + |
| 36 | +For Basic Auth, give it a name, choose a username and password, and hit |
| 37 | +`Create Auth Method`. |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +#### API Key |
| 42 | + |
| 43 | +For API Key, just choose a name, and click `Create Auth Method`. An API key is |
| 44 | +generated for you. |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +You can edit or delete your auth methods on this page as well. |
| 49 | + |
| 50 | +// screenshot |
| 51 | + |
| 52 | +Once you added an auth method to a webhook, it will show up under |
| 53 | +`Linked Triggers`. |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +### Adding Authentication Via a Workflow |
| 60 | + |
| 61 | +On your Workflows you can use the auth methods you created under |
| 62 | +`Project Settings`, or you can create a new one. |
| 63 | + |
| 64 | +When you click on `Add authentication` under `Webhook Authentication`, select a |
| 65 | +(or multiple) existing method(s), or hit `Create a new webhook auth method`. |
| 66 | +Refer to the `Basic Auth` and `API Key` sections above for details on adding |
| 67 | +these. |
| 68 | + |
| 69 | +Once you've added an auth method, it will show up in your Webhook Trigger |
| 70 | +configuration. |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +Only requests using these required auth details will be able to send data to |
| 75 | +your Workflow. |
0 commit comments