Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsValidJWToken is false #81

Closed
sonnd9x opened this issue Nov 13, 2017 · 3 comments
Closed

IsValidJWToken is false #81

sonnd9x opened this issue Nov 13, 2017 · 3 comments

Comments

@sonnd9x
Copy link

sonnd9x commented Nov 13, 2017

I', trying to use this lib. But, I get probem

client = new WordPressClient("http://duhoc.thaison.top/wp-json") { AuthMethod = AuthMethod.JWT }; await client.RequestJWToken("username", "password"); var IsValidToken = await client.IsValidJWToken();
IsValidToken always return false.

@polushinmk
Copy link
Contributor

Hi!
Are you sure, that you install this plugin
https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/
and configure it correctly?

PHP HTTP AUTHORIZATION HEADER ENABLE

Most of the shared hosting has disabled the HTTP Authorization Header by default.

To enable this option you’ll need to edit your .htaccess file adding the follow

RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.)
RewriteRule ^(.
) - [E=HTTP_AUTHORIZATION:%1]
WPENGINE

To enable this option you’ll need to edit your .htaccess file adding the follow

See Tmeister/wp-api-jwt-auth#1

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
CONFIGURATION

CONFIGURATE THE SECRET KEY

The JWT needs a secret key to sign the token this secret key must be unique and never revealed.

To add the secret key edit your wp-config.php file and add a new constant called JWT_AUTH_SECRET_KEY

define('JWT_AUTH_SECRET_KEY', 'your-top-secrect-key');
You can use a string from here https://api.wordpress.org/secret-key/1.1/salt/

@sonnd9x
Copy link
Author

sonnd9x commented Nov 14, 2017

Thank you. It worked.

@sonnd9x sonnd9x closed this as completed Nov 14, 2017
@MohammedTuhami330
Copy link

Hi! Are you sure, that you install this plugin https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/ and configure it correctly?

PHP HTTP AUTHORIZATION HEADER ENABLE
Most of the shared hosting has disabled the HTTP Authorization Header by default.
To enable this option you’ll need to edit your .htaccess file adding the follow
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.)
RewriteRule ^(.
) - [E=HTTP_AUTHORIZATION:%1]
WPENGINE
To enable this option you’ll need to edit your .htaccess file adding the follow
See Tmeister/wp-api-jwt-auth#1
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
CONFIGURATION
CONFIGURATE THE SECRET KEY
The JWT needs a secret key to sign the token this secret key must be unique and never revealed.
To add the secret key edit your wp-config.php file and add a new constant called JWT_AUTH_SECRET_KEY
define('JWT_AUTH_SECRET_KEY', 'your-top-secrect-key');
You can use a string from here https://api.wordpress.org/secret-key/1.1/salt/

i'm using c# to connect By wordoressPCL ,, How i can install and config plugin by Php files

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

No branches or pull requests

3 participants