Wordpress Webhook 401 error


(nash ) #1

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

<!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

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.


(Simon Cossar) #2

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


(nash ) #3

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

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

and I set Discourse URL to 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.


(Simon Cossar) #4

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


(nash ) #5

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

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

in the header


(Simon Cossar) #6

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


(nash ) #7

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


(nash ) #8

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.


(Joshua Rosenfeld) #9

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