openid-connect-generic
openid-connect-generic copied to clipboard
ERROR: No authentication code present in the request.
Hello I have enabled the plugin on my WP website and using openedx as my validator. When I use my generic URI https://waqas.datasciencedojo.com/openid-connect-authorize it gives em below error and take me to login page. There I have a btn called 'Login with OpenID Connect' when I click that it takes me to edx and I log in and it successfully redirects to me to wp dashboard but why this issue in the middle. Below is the error I get. Also after successfull login I would like to redirect to a custom URL not to the wp admin itself. Please help
Type: no-codeDate: 2020-05-04 22:16:53User: 0URI : /openid-connect-authorize | object(WP_Error)#8309 (2) { ["errors"]=> array(1) { ["no-code"]=> array(1) { [0]=> string(46) "No authentication code present in the request." } } ["error_data"]=> array(0) { } } -- | --
Same here: I don't know why this intermediate page with the error code is shown - it should connect immediately to Keycloak and then give me a session.
This sounds like an IDP misconfiguration. Have you reviewed the Keycloak IDP configuration guide?
Well, what I tried is to link to https://mysite.org/wp-admin/admin-ajax.php?action=openid-connect-authorize from a linked key image :key: . But I understand this is the callback URI.
Is there a static URL generating the same as [openid_connect_generic_auth_url] so that I can link to it from any object, image or text? I am not aware of an option to define such a shortcode as a href link target.
OK, yeah you can't use the callback URL for a link on your site. I don't quite understand what you are asking for. You should just be using the openid_connect_generic_auth_url shortcode. There is not a static URL as there is a time limit nonce that is generated each time the URL is generated and this is passed to the IDP and back in order to prevent replay attacks.
I found a solution to replace the Login text with an icon as suggested here https://github.com/oidc-wp/openid-connect-generic/issues/159#issuecomment-1508381287