Hi, I managed to hook up a custom form to let users enter additional data via the root /authorize .
After receiving the token I should call the root /userinfo, to be able to get all the user data, and here I would also like to hook up to give the additional data, but unfortunately if I call the endpoint, it replies 404.
I’m trying with postman in get, moreover I tried to insert the token in the call but nothing, it always replies 404. What should I do to get the user’s data?
thank you very much
]]>I called the first endpoint : /wp-json/openid-connect/v1/authorize?response_type=code&client_id=postman&scope=openid profile&state=af0ifjsldkj
and it sent me to the authorization screen, clicking on authorize I get this error.
Please can you help me understand what went wrong?
Warning: openssl_sign(): Supplied key param cannot be coerced into a private key in?/var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/Encryption/Jwt.php?on line?161
Fatal error: Uncaught Exception: Unable to sign data. in /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/Encryption/Jwt.php:162 Stack trace: #0 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/Encryption/Jwt.php(139): OAuth2\Encryption\Jwt->generateRSASignature() #1 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/Encryption/Jwt.php(31): OAuth2\Encryption\Jwt->sign() #2 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/OpenID/ResponseType/IdToken.php(147): OAuth2\Encryption\Jwt->encode() #3 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/OpenID/ResponseType/IdToken.php(118): OAuth2\OpenID\ResponseType\IdToken->encodeToken() #4 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/OpenID/Controller/AuthorizeController.php(62): OAuth2\OpenID\ResponseType\IdToken->createIdToken() #5 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/Controller/AuthorizeController.php(135): OAuth2\OpenID\Controller\AuthorizeController->buildAuthorizeParameters() #6 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php(383): OAuth2\Controller\AuthorizeController->handleAuthorizeRequest() #7 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/src/Http/Handlers/AuthorizeHandler.php(56): OAuth2\Server->handleAuthorizeRequest() #8 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/src/Http/Router.php(117): OpenIDConnectServer\Http\Handlers\AuthorizeHandler->handle() #9 /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/src/Http/Router.php(111): OpenIDConnectServer\Http\Router->do_handle_request() #10 /var/www/fir/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1230): OpenIDConnectServer\Http\Router->handle_rest_request() #11 /var/www/fir/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request() #12 /var/www/fir/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch() #13 /var/www/fir/httpdocs/wp-includes/rest-api.php(428): WP_REST_Server->serve_request() #14 /var/www/fir/httpdocs/wp-includes/class-wp-hook.php(324): rest_api_loaded() #15 /var/www/fir/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #16 /var/www/fir/httpdocs/wp-includes/plugin.php(565): WP_Hook->do_action() #17 /var/www/fir/httpdocs/wp-includes/class-wp.php(418): do_action_ref_array() #18 /var/www/fir/httpdocs/wp-includes/class-wp.php(813): WP->parse_request() #19 /var/www/fir/httpdocs/wp-includes/functions.php(1336): WP->main() #20 /var/www/fir/httpdocs/wp-blog-header.php(16): wp() #21 /var/www/fir/httpdocs/index.php(17): require(‘…’) #22 {main} thrown in /var/www/fir/httpdocs/wp-content/plugins/openid-connect-server/vendor/bshaffer/oauth2-server-php/src/OAuth2/Encryption/Jwt.php on line 162
]]>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
]]>I’ll explain the system to you: My WordPress installation will act as the server, a user goes to the client site and clicks to log in. At this point the client calls my server on an endpoint?
I think it will start with the first on this list and then continue with the others, right?
1 -“authorization_endpoint”:”/wp-json\/openid-connect\authorize”,
2 – “token_endpoint”:”/wp-json\/openid-connect/token”,
3 – “userinfo_endpoint”:”/wp-json/openid-connect/userinfo”,
if this is what I understand, it’s correct, i need that : if at the first endpoint the plugin sees that the user does not have an account on WordPress it does not send the authorization right? I would therefore like to have it open a registration page so that the user can register, and once registration is complete, resume the login flow
where can I hook up to do this?
thank you very much
]]>Before logging in a user I need to ask the client for authorization which will respond to me with a code, so I have to insert an additional call before logging in. Can you tell me where I can insert it to stop the login process and wait for this code?
and if the user is not registered, can I register him and land him on a registration page? and then resume the login process?
thank you very much
]]>I need to pass additional data to the client after login, this data is in the users’ meta data, can I use this filter to insert additional data?
apply_filters( ‘oidc_user_claims’, $claims, $user )
]]>Hi there,
I’m pretty brand new to running/configuring WordPress, so apologies if these questions seem silly. I’ve read the README, but I’m still a bit unclear as to which files I should edit to add the configuration to.
I’ve got WordPress running in a Docker container, so I presume it’s a pretty vanilla install. I’ve created the public and private keys, but I’m not clear which file I should add the define( 'OIDC_PUBLIC_KEY'
bits? Is the /index.php appropriate?
For the add_filter(
lines, it mentions using a functions.php
file from a theme. I appear to have three themes preinstalled. Would wp-content/themes/twentytwentyone/functions.php be the appropriate file to append this to?
Am I right to assume that once the plugin is configured correctly, that if my site is running on https://localhost:8080/ that I should be able to hit https://localhost:8080/.well-known/openid-configuration ?
thanks,
David