Closed erikdietrich closed 5 years ago
Try using client = new WordPressClient(baseUrl,"wp-json/wp/v2/"); and I have installed/configured JWT Authentication for WP-API plugin
Thanks for the suggestion. Unfortunately, I gave it a try, and no luck. Same result.
what error you receive? Sorry, i forget but i have modified the WordPressClient.cs file in the line 21, change the code from: private const string _jwtPath = "jwt-auth/v1/"; to: private const string _jwtPath = "wp-json/jwt-auth/v1/";
The error is "Server returned HTTP status Forbidden."
Here's the stack trace:
at WordPressPCL.Utility.HttpHelper.<PostRequest>d__20
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at WordPressPCL.WordPressClient.
and the response:
{StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:{ Transfer-Encoding: chunked Connection: keep-alive Vary: X-Forwarded-Proto Host-Header: 192fc2e7e50945beb8231a492d6a8024 Referrer-Policy: Access-Control-Allow-Origin: * Cache-Control: public, must-revalidate, no-cache, max-age=0 Date: Sun, 24 Mar 2019 16:12:11 GMT Server: nginx Content-Type: text/html; charset=utf-8 Expires: Wed, 11 Jan 1984 05:00:00 GMT}}
I'm closing this for you. I appreciate the plugin and I like the API, but I wound up just implementing the functionality, myself, in my own codebase.
I got this also, any solution?
Hi there. I was hoping someone might be able to help me.
I have the following code, appropriated from the example.
When I run it, however, it kicks back a 403, with "WordPressPCL.Models.WPUnexpectedException: 'Server returned HTTP status Forbidden'" This happens in the call to RequestJWToken().
This isn't an htaccess issue nor is it anything on the server side. I'm able to use Postman to get a token, validate it, and use it to access drafts, delete posts, etc. So everything is working on the server and I'm able to navigate the REST API.
I'm not sure what I'm missing... any ideas would be very much appreciated.