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?
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?
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?
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 1 year, 9 months ago by
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', ), );}