Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user_metadata no longer being passed to auth0_user_login action on registration #431

Closed
talamihg opened this issue Apr 12, 2018 · 3 comments

Comments

@talamihg
Copy link

Regarding this action - 'auth0_user_login'

function a0_docs_ex_auth0_user_login ( $user_id, $userinfo, $is_new, $id_token, $access_token ) {
  // ... do something after logging in
}
add_action( 'auth0_user_login', 'a0_docs_ex_auth0_user_login', 10, 5 );

When a user registers for the first time, i was expecting user_metadata to be passed in along with $userinfo however its no longer included when logging in for the first time.
I was using this hook to set some user metadata, $userinfo->user_metadata, when $is_new is true and when they were initially being created in WP.

Is there a different hook I should use, or a different function/ way to get user_metadata?

When the user loggs in for the 2nd+ times, when $is_new is false, user_metadata is included, but this is too late in the registration process for me.

Using v3.5.2

Thanks!

@joshcanhelp
Copy link
Contributor

Hi @talamihg!

Are you saying this is a change of functionality from a previous version?

This action runs in the same place at the same time regardless of whether this is a login or a signup. The $userinfo parameter is either:

  • Data from the /api/v2/users/{id} endpoint of the Management API if you're using the default login method or ...
  • Data from the id_token if you're using the Implicit flow (switch under Advanced ... this should be off for most sites) or SSO (forces the site to use Implicit flow, which does not include metadata)

If you are using that second scenario for either reason, you might be able to accomplish what you need using a Rule, discussed in this community thread:

https://community.auth0.com/t/how-to-retrieve-user-metadata-in-the-id-token/6667

Otherwise, I just tested a signup using the regular login process and I get user_metadata back, as expected.

@talamihg
Copy link
Author

I must be using the Implicit flow because I am logging in with SSO, and was not aware of the different types of methods. This is great info, thanks. I figured that the wp-auth0 plugin was working as designed, but I didn't know where along the login flow things would have changed with all the recent updates.

Thanks @joshcanhelp. I'll read into that community thread.

@joshcanhelp
Copy link
Contributor

@talamihg - Happy to help! I'll mark this as closed but feel free to comment back if you need anymore guidance.

Just a heads up on SSO ... we're going to be changing that soon to point to the hosted login page, which will make this work like the default login method.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants