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

invalid-secret-key | Algorithm not allowed #179

Open
ivanrubberduck opened this issue Jul 19, 2023 · 5 comments
Open

invalid-secret-key | Algorithm not allowed #179

ivanrubberduck opened this issue Jul 19, 2023 · 5 comments

Comments

@ivanrubberduck
Copy link

Hi team, when I make a request I receive the below error but I configured the plugin correctly as per the documentation:

Screenshot 2023-07-19 160324

Do you have any idea why this is happening?

I am using the latest Grahpql version and the latest JWT auth version as well. I added in my function the below code:

add_filter( 'graphql_jwt_auth_secret_key', function() { return env("AUTH_KEY"); });

And populated the AUTH_KEY from https://api.wordpress.org/secret-key/1.1/salt/

In the headers I am sending the token as per the documentation:

Screenshot 2023-07-19 160736

@webdevi121
Copy link

Hi @ivanrubberduck

I also have the same issue right now when updating users. Have you found any answers yet?

@ryancheta
Copy link

ryancheta commented Mar 19, 2024

Any updates on this? Anyone?

@andrewgolovanov
Copy link

andrewgolovanov commented May 22, 2024

I'm getting the same error

PHP: 8.2
Wordpress: 6.5.3
WPGraphQL: 1.18.1
WPGraphQL JWT Authentication: 0.7.0

@andrewgolovanov
Copy link

@webdevi121 @ryancheta

I ended up getting rid of this problem with this solution - #165 (comment)

@ivanrubberduck
Copy link
Author

ivanrubberduck commented May 23, 2024

Hey everybody, I managed to fix it the following way:

/**
 * JWT uses a Secret defined on the server to validate the signing of tokens.
 * It's recommended that you use something like the WordPress Salt
 * generator (https://api.wordpress.org/secret-key/1.1/salt/) to generate a Secret.
 */

I added define('GRAPHQL_JWT_AUTH_SECRET_KEY', 'AUTH_KEY'); in my wp-config.php file BUT it is super important to add it above

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}

Your wp-config.php file should look something like that:

define('GRAPHQL_JWT_AUTH_SECRET_KEY', 'b5$RIQEcU&j{}v$YDsfQ<B,V(IOa=DuSuS?93OP-+A,{o5/<85-(gw(=@8In=x1W');

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

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

4 participants