Answer the question
In order to leave comments, you need to log in
Program freezes when trying to perform JWT authorization with a WP site?
Did everything according to this instruction.
I installed plugins for JWT authorization and REST API, exactly those that are indicated there.
I edited the .htaccess of the site by adding the indicated lines, now it looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</IfModule>
define('JWT_AUTH_SECRET_KEY', 'тут токен, который я сам придумал');
define('JWT_AUTH_CORS_ENABLE', true);
private void Button1_Click(object sender, EventArgs e)
{
client = GetClient().Result;
}
private async Task<WordPressClient> GetClient()
{
// JWT authentication
var client = new WordPressClient(WP_URL);
client.AuthMethod = AuthMethod.JWT;
await client.RequestJWToken(ADMIN, PASSWORD);
return client;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question