Skip to content
This repository has been archived by the owner on May 7, 2019. It is now read-only.

I can't get the jwt token #73

Open
ali-sao opened this issue May 4, 2019 · 0 comments
Open

I can't get the jwt token #73

ali-sao opened this issue May 4, 2019 · 0 comments

Comments

@ali-sao
Copy link

ali-sao commented May 4, 2019

Hello ,

I am suffering with WP JWT , whenever I request a token , the response is always : [jwt_auth] empty_username

I did everything required to get the JWT plugin working fine :

in wp-config.php :

define('JWT_AUTH_SECRET_KEY', 'MY_SUPER_PASSWORD');
define('JWT_AUTH_CORS_ENABLE', true);

in .htacess

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

The request structure is the same :

WordpressAPI.prototype.getJWTToken = function(username, password) {
  var requestUrl = this.url + "/wp-json/jwt-auth/v1/token/";
  var options = {
    method: "POST",
    headers: {
      Accept: "application/json",
      "Content-Type": "application/json"
    },
    withCredentials: false,
    body: JSON.stringify({ username, password })
  };
  return fetch(requestUrl, options).then(response => response.json());
};

What should I do ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant