Hi.
I am trying to integrate my Wordpress site with auth0.
I added auth0 official plugin, configured it and I added auth0_user_login hook in my functions.php file on the following way:
function auth0_docs_hook_auth0_user_login( $user_id, $userinfo, $is_new, $id_token, $access_token, $refresh_token ) {
echo '<strong>WP user ID</strong>:<br>' . $user_id . '<hr>';
echo '<strong>Auth0 user info</strong>:<br><pre>' . print_r( $userinfo, true ) . '</pre><hr>';
echo '<strong>Added to WP DB?</strong>:<br>' . ( $is_new ? 'yep' : 'nope' ) . '<hr>';
echo '<strong>ID Token</strong>:<br>' . ( $id_token ? $id_token : 'not provided' ) . '<hr>';
echo '<strong>Access Token</strong>:<br>' . ( $access_token ? $access_token : 'not provided' ) . '<hr>';
echo '<strong>Refresh Token</strong>:<br>' . ( $refresh_token ? $refresh_token : 'not provided' ) . '<hr>';
wp_die( 'Login successful! <a href="' . home_url() . '">Home</a>' );
}
add_action( 'auth0_user_login', 'auth0_docs_hook_auth0_user_login', 10, 6 );
I added app_metadata info to my user and that info is visible from auth0 admin panel.
However, after login, $userInfo object inside the hook I pasted above, does not contain neither user_metadata nor app_metadata objects.
Why is that?
Thank you for the help.