Tmeister / wp-api-jwt-auth

A simple plugin to add JSON Web Token (JWT) Authentication to WP REST API
GNU General Public License v2.0
558 stars 160 forks source link

Every endpoint works except wp-json/jwt/v1/token (404 - No route was found matching the URL and request method) #172

Closed Steffi3rd closed 1 year ago

Steffi3rd commented 5 years ago

Hello guys,

I'm using this plugin for a while in development, but now I'm in production and it doesn't work.

Every endpoint works except this : wp-json/jwt/v1/token

I have this response :

{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}

My htaccess is already set up

# BEGIN JWT
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
# END JWT

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

I also add my JWT_AUTH_SECRET_KEY

define('JWT_AUTH_SECRET_KEY', 'your-top-secrect-key');

What else can I do to fix this please?

Windygo commented 5 years ago

Having exact same issue. /token endpoint returns

{ "code": "rest_no_route", "message": "No route was found matching the URL and request method", "data": { "status": 404 } }

kdpuvvadi commented 4 years ago

Same error Here mate, any solution as of now?

dub34 commented 4 years ago

Hi. Try this POST wp-json/jwt-auth/v1/token. Version 1.2.6,

You can call wp-json/ and in the response you can found all available namespaces. Hope it can help

pravinfullstack commented 4 years ago

Try disabling and reinstall plugin.

adamgen commented 4 years ago

I had this issue when sending GET requests, sending POST resolved it for me.

AEiosApp commented 2 years ago

Same issue here, any solution?

anwarr1 commented 2 years ago

Same issue here, any solution?

mian678 commented 2 years ago

Same issue here, Any solution?

I am trying POST request, but still getting the same error

vagkalosynakis commented 1 year ago

I was struggling for a while with this and even though I was using POST to make the request I was still having issues.

What solved it for me is having to write https:// before my URL. Previously I was using the URL only and I was getting rest_no_route while I had written the .htaccess rules according to the documentation and also restart my server.

LordSimal commented 1 year ago

Also make sure you specify the URL correctly (see output of /wp-json for all valid JSON URLs)

So I tried https://mydomain.com/wp-json/jwt-auth/v1/token but instead I had to use https://www.mydomain.com/wp-json/jwt-auth/v1/token (notice the added www. at the start)

tkreuder commented 11 months ago

@LordSimal thanks a lot. That also fixed it for me!

SFTecnologia2018 commented 7 months ago

boa noite, para mim o erro era um espaço a mais no final da URL ("/wp-json/jwt-auth/v1/token ") de token removi o espaço e funcionou, outra coisa que fiz mas não sei se fez diferença, foi fazer as configurações primeiro e depois ativar o plugin, na alteração do .htaccess fiz em 2 arquivos, na pasta "public_html" na raiz de todos os domínios e no .htaccess no domínio da API. estou usando Hostgator com múltiplos domínios