# Wordpress Webhook 401 error

**URL:** https://meta.discourse.org/t/wordpress-webhook-401-error/79890
**Category:** WordPress
**Created:** [February 6, 2018, 8:26am UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890 "2018-02-06T08:26:50Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![nash4ever](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nash4ever](https://meta.discourse.org/u/nash4ever)
#### Post date: [February 6, 2018, 8:26am UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/1 "2018-02-06T08:26:50Z")

</div>

Hi,  
I would like to use webhooks but when I call my endpoints I get this error:

```plaintext
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<hr>

```

### Headers

```plaintext
Server: Apache/2.4.18 (Ubuntu)
WWW-Authenticate: Basic realm="Restricted Content"
Content-Length: 466
Connection: close
Content-Type: text/html; charset=iso-8859-1

```

Do you have any idea what is the problem?

Thanks for your help.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [February 6, 2018, 4:04pm UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/2 "2018-02-06T16:04:35Z")

</div>

Are you using the wp-discourse plugin, or are these endpoints that you have added yourself?

---

<div class="post-metadata">

### Author: ![nash4ever](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nash4ever](https://meta.discourse.org/u/nash4ever)
#### Post date: [February 6, 2018, 6:48pm UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/3 "2018-02-06T18:48:14Z")

</div>

I’m using the official wp-discourse plugin.  
What I see int he Webhook log that my

```plaintext
X-Discourse-Instance: http://forum.example.com

```

and I set Discourse URL to [https://forum.example.com](https://forum.example.com) on the WP settings page.

FYI: if it can be an issue, then I could not change the X-Discourse-Instance to https, I don’t know where can I change it.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [February 6, 2018, 6:53pm UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/4 "2018-02-06T18:53:36Z")

</div>

> [@nash4ever](#):
>
> FYI: if it can be an issue, then I could not change the X-Discourse-Instance to https, I don’t know where can I change it.

Have you enabled the ‘force https’ setting on Discourse?

---

<div class="post-metadata">

### Author: ![nash4ever](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nash4ever](https://meta.discourse.org/u/nash4ever)
#### Post date: [February 6, 2018, 7:08pm UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/5 "2018-02-06T19:08:47Z")

</div>

> [@simon](#):
>
> Have you enabled the ‘force https’ setting on Discourse?

No, but I chaged it after your post and the error is the same, but now I’m sending:

```plaintext
X-Discourse-Instance: https://forum.example.com

```

in the header

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [February 6, 2018, 7:50pm UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/6 "2018-02-06T19:50:44Z")

</div>

Is the webhook payload URL set to `https://yoursite.com/wp-json/wp-discourse/v1/update-topic-content` ?

What version of WordPress are you using?

There might be some ideas on this page that can help: [Authorization Errors with Wordpress API - Justin D Johnson](http://justindjohnson.com/softdev/wordpress-api-401/)

---

<div class="post-metadata">

### Author: ![nash4ever](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nash4ever](https://meta.discourse.org/u/nash4ever)
#### Post date: [February 6, 2018, 7:53pm UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/7 "2018-02-06T19:53:19Z")

</div>

Our Payload URL:  
`https://example.com/wp-json/wp-discourse/v1/update-topic-content`

> What version of WordPress are you using?

WordPress 4.9.3

---

<div class="post-metadata">

### Author: ![nash4ever](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@nash4ever](https://meta.discourse.org/u/nash4ever)
#### Post date: [February 6, 2018, 8:09pm UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/8 "2018-02-06T20:09:20Z")

</div>

Thanks for all of your help, the problem was on my side, I forgot that I set http authentication on the site because it is not public.  
I apologize for wasting your time.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [February 7, 2018, 11:00pm UTC](https://meta.discourse.org/t/wordpress-webhook-401-error/79890/9 "2018-02-07T23:00:02Z")

</div>

This topic was automatically closed after 25 hours. New replies are no longer allowed.
