• Resolved Matteo182

    (@matteo182)


    Hi again, thanks for the help

    I configured the plugin as explained in the repository:

    I created the two keys and inserted them into the wp-config before require_once ABSPATH and

    i created another plugin to insert my client with this filter

    add_filter( ‘oidc_registered_clients’, ‘my_oidc_clients’ );

    but now if I go to the page /.well-known/openid-configuration it continues to give me error 404

    and even if I call with postman this endpoint /wp-json/openid-connect/authorize i get this message :

    {

        “code”: “rest_no_route”,

    ? ? “message”: “No path provides a match between the URL and the requested method.”,

        “data”: {

            “status”: 404

        }

    }

    what did I do wrong?

    Are there any endpoint initializations missing?

    How can I make a test call?

    thank you very much

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Paulo Pinto

    (@psrpinto)

    I think this might be related to this issue: https://github.com/Automattic/wp-openid-connect-server/issues/81

    Could you try changing the permalink structure as described in the issue and see if the problem persists?

    Thread Starter Matteo182

    (@matteo182)

    I tried to modify the permalinks as it says in the link you wrote to me, if I use the permalinks with Simple structure, the first one so to speak, if I make the call it replies by sending me the home page, I don’t know if this is correct, I was expecting an answer via json ?

    however, if I use any other structure it always gives me a 404 error, even if I use the custom structure and remove the / at the end, it always gives me a 404.

    Maybe I need to call the endpoint by sending it the user’s email?

    Thread Starter Matteo182

    (@matteo182)

    I think I solved the permalink problem, i add .'/v1', at the end of prefix , the function is : 

    add_action(

    ? ? ? ? ? ? 'rest_api_init',

    ? ? ? ? ? ? function () use ( $route, $methods, $args ) {

    ? ? ? ? ? ? ? ? register_rest_route(

    ? ? ? ? ? ? ? ? ? ? self::PREFIX.'/v1',

    ? ? ? ? ? ? ? ? ? ? $route,

    ? ? ? ? ? ? ? ? ? ? array(

    ? ? ? ? ? ? ? ? ? ? ? ? 'methods' ? ? ? ? ? ? => $methods,

    ? ? ? ? ? ? ? ? ? ? ? ? 'permission_callback' => '__return_true',

    ? ? ? ? ? ? ? ? ? ? ? ? 'callback' ? ? ? ? ? ?=> array( $this, 'handle_rest_request' ),

    ? ? ? ? ? ? ? ? ? ? ? ? 'args' ? ? ? ? ? ? ? ?=> $args,

    ? ? ? ? ? ? ? ? ? ? )

    ? ? ? ? ? ? ? ? );

    ? ? ? ? ? ? }

    ? ? ? ? );

    and now the respons with Postman is :

    {

    ? ? "code": "rest_missing_callback_param",

    ? ? "message": "Parametro(i) mancante(i): client_id, response_type",

    ? ? "data": {

    ? ? ? ? "status": 400,

    ? ? ? ? "params": [

    ? ? ? ? ? ? "client_id",

    ? ? ? ? ? ? "response_type"

    ? ? ? ? ]

    ? ? }

    }

    the answer is like this because I’m not calling from the client URL I registered right? But was the v1 endpoint registered correctly?

    Thread Starter Matteo182

    (@matteo182)

    i make this call /wp-json/openid-connect/v1/authorize?response_type=code&client_id=postman&scope=openid profile&redirect_uri=https%3A%2F%2Fwww.getpostman.com%2Foauth2%2Fcallback

    and i register the client in this way :

    add_filter( 'oidc_registered_clients', 'iquii_oidc_clients' );

    function iquii_oidc_clients() {

    ? ? return array(

    ? ? ? ? 'client_id_random_string' => array(

    ? ? ? ? ? ? 'name' => 'postman',

    ? ? ? ? ? ? 'secret' => 'a secret string',

    ? ? ? ? ? ? 'redirect_uri' => 'https://www.getpostman.com/oauth2/callback',

    ? ? ? ? ? ? 'grant_types' => array( 'authorization_code' ),

    ? ? ? ? ? ? 'scope' => 'openid profile',

    ? ? ? ? ),

    ? ? );

    }

    but i receve this error:

    {

        “error”: “invalid_client”,

        “error_description”: “The client id supplied is invalid”

    }

    Did I make a mistake in recording the client or the call?

    • This reply was modified 8 months, 2 weeks ago by Matteo182.
    Thread Starter Matteo182

    (@matteo182)

    ok I understood the error, I modified the random string of the array index

    add_filter( 'oidc_registered_clients', 'iquii_oidc_clients' );function iquii_oidc_clients() {? ? return array(? ? ? ? 'postman' => array(? ? ? ? ? ? 'name' => 'postman',? ? ? ? ? ? 'secret' => 'a secret string',? ? ? ? ? ? 'redirect_uri' => 'https://www.getpostman.com/oauth2/callback',? ? ? ? ? ? 'grant_types' => array( 'authorization_code' ),? ? ? ? ? ? 'scope' => 'openid profile',? ? ? ? ),? ? );}
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Initial configuration’ is closed to new replies.