Skip to content

"invalid-secret-key | Algorithm not allowed" with WPGatsby plugin #165

Description

@Joelgeorgelive

This happens only when WPGatsby plugin in installed on wordpress

wp-graphql-jwt-authentication / release-v0.5.2

Ran into this issue after trying to fetch Gql data using authToken.

File to edit: \wp-content\plugins\wp-graphql-jwt-authentication-release-v0.5.2\src\Auth.ph

Screenshot 2022-06-17 135004

Screenshot 2022-06-17 135142

This change fixed it , Now I can fetch data from Gql

Screenshot 2022-06-17 135328

try {
$token = ! empty( $token ) ? JWT::decode( $token, self::get_secret_key(),array_keys(JWT::$supported_algs) ) : null;
} catch ( Exception $exception ) {
$token = new \WP_Error( 'invalid-secret-key', $exception->getMessage() );
}

tried passing in array('HS256') or ['HS256'] didnt work. idk why!!...

P.S. did break my head for a day .... Hope it helps someone.. #notaprogrammer

Feel free to optimize this code!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions