openid-connect-generic
openid-connect-generic copied to clipboard
Syncing user data fields between Wordpress and OIDC server (Keycloak)
Hi, just wondering if there's any way to sync user data (custom fields) between Wordpress and Keycloak? If so, could someone point me in the right direction? Thanks!
From keycloak to wordpress can be done via hooks, for revese, I'm researching as well
@bevinhex Is there documentation on how to do that with hooks?
@alerque I don't think there is documentation atm, but I could write up something simple. Currently working on another plugin that will provide a UI for this, but it's probably a few weeks out.
here is a very rough draft to get you started
<?php
add_action( 'openid-connect-generic-user-logged-in', 'my_oidc_user_login' );
function my_oidc_user_login( \WP_User $user ) {
// Everything we know about the user from the IDP.
$id_token_claim = get_user_meta( $user->ID, 'openid-connect-generic-last-id-token-claim', true );
$subject_identity = get_user_meta( $user->ID, 'openid-connect-generic-subject-identity', true );
$user_claim = get_user_meta( $user->ID, 'openid-connect-generic-last-user-claim', true );
$token_response = get_user_meta( $user->ID, 'openid-connect-generic-last-token-response', true );
// Do something w/ it here...
}
Hello @daggerhart Sent you an email from your contact form. Just checking to see if you received it