baranovskypd / goodpress

WIP!! :warning: R Package to Write Posts from R Markdown to Wordpress :warning:
https://maelle.github.io/goodpress/
Other
34 stars 5 forks source link

I keep getting Error 401 #33

Open unbrother opened 2 years ago

unbrother commented 2 years ago

I am not sure if this is the right place to post this issue, but since Wordpress is not using the authorization plugin and it has been integrated inside, I believe this is what causes me an error showing that I am unauthorized with code 401. I am not sure if this is due to my credentials being wrong or something else. I have checked everything there is online but information is scarce, at least for this error.

maelle commented 2 years ago

Ah you mean you use a newer version of Wordpress stuff? I haven't used goodpress in a long time so can't help. @henrywangnl do you happen to have any insight?

henrywangnl commented 2 years ago

Hmm, it's still working well for me as I just tested it. My WordPress is the latest: v5.9.2

unbrother commented 2 years ago

I also have v5.9.2. Updated everything, talked to my hosting provider. Now I am getting bad request 400. Exact error is

Error in wp_call_api(VERB = "POST", api_url = api_url, body = post) : 
  Bad Request (HTTP 400).
nordicai commented 2 years ago

I had the same problem (HTTP 400). I did some debugging and found that REST-API require the date to have the format YYYY-MM-DDTHH:MM:SS. This is controlled by the "date" field in the index.Rmd. You can remove it and WP will assume the time when it was posted. Or you define your own as long as it follows the above mentioned format.
date: "r Sys.Date()" does not work for me as well.

maelle commented 2 years ago

@nordicai thanks for the digging! If you want, you can make a PR to improve docs/templates in this repository (and add yourself as ctb to DESCRIPTION in that case).

Dennishi0925 commented 1 year ago

Also got the error code: Error in wp_call_api(VERB = "GET", api_url = api_url) : Unauthorized (HTTP 401). Have checked the application password, the Rmd/md file, and the .htaccess file. Did anyone encounter the problem and get it solved?

Dennishi0925 commented 1 year ago

update: I switched to the MAC OS from Windows and didn't meet the problem below

Lextuga007 commented 1 year ago

I have the same problem but I don't have access to a MAC 😞 I wonder if it's the date format which occurs if I write "2019-03-07T01:01:00" or remove it altogether.

maelle commented 1 year ago

@Lextuga007 you mean that whatever you do to the date, it doesn't work?

What OS are you on? Hoping someone has experience with it and goodpress. :sweat_smile:

Lextuga007 commented 1 year ago

There is a strong possibility that the problem is because I'd missed the step where the WordPress add in is needed! It's for a managed page so I didn't do it just in case but I haven't given up and I'll give it another go on a couple of weeks!