Closed Vitaliy-Steffensen closed 3 years ago
have you checked if you can get a token through the rest api, e.g. with Postman? Seems your server isn't returning a token at that point.
Hi,
same here. I used for api
new WordPressClient("https://traders-view.services/api/");
also by chaning to https://traders-view.services/?rest_route=/
but i dont get a
var isValidToken = await client.IsValidJWToken();
Back so i cant go fw. Before (3 months ago) it was working.
Br Sniper
Hi, @ThomasPe
When debugging with fiddler if you use http://yourdomain.com instead of https://yourdomain.com httpclient method seems changed to GET but it should be POST.
GET https://yourdomain.com/wp-json/jwt-auth/v1/token HTTP/1.1 Content-Type: application/x-www-form-urlencoded Host: yourdomain.com
{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}
Reference: https://stackoverflow.com/questions/37373138/httpclient-post-generates-get-instead
Well if I read that post correctly the redirect is happening on the server side when switching from www to non-www (or vice versa). Nothing the httpclient can do about.
Added a note in the Troubleshooting Wiki, a WPException should be thrown in this case. https://github.com/wp-net/WordPressPCL/wiki/Troubleshooting
I'm trying to connect to the REST API using the wordpressCPL plugin using the jwt auth. Tho when ever I try to request my JWT token, it just seems like the code stops. It doesn't get any errors, it just doesn't get to run any code after the request line. (ofc i don't have "###" as my user & pass)
`private static async Task GetClient()
{
// JWT authentication
var client = new WordPressClient("http://zoly.dk/wp-json/");
client.AuthMethod = AuthMethod.JWT;
await client.RequestJWToken("###", "###");
//The code never gets to here!!!
return client;
}