Cannot get access token or userID at the post-login event for the progressive profiling

I want to implement following logic.

First a user open sign up page. Fills email, password. Click continue and redirect to RedirectedPage where I can get more details from the user.

In this step I want to get additional data from the user like subscription plan, address etc with forms and send REST API request to my server in order to store it in my external database. (Or I can save them in the user_metadata of Auth0)

I used Auth0 React npm package until now.
But I cannot get the user or silentAccessToken since there the user seems like not actually be logged in.

Could you please let me know how I can get userID in this case?

Hi @david.guodev17,

Welcome to the Auth0 Community!

I understand that you are looking to gather additional data from the user for progressive profiling.

In this situation, I recommend using a Post-Login Action to enrich the user’s profile.

If needed, you could use the Post-Login Action to redirect the user to your custom-hosted page to get additional information from the user.

I hope this helps!

Please let me know if you have any questions or need further assistance.

Thanks!

Hi @rueben.tiow ,
Thank you for your response.

I already following that logic.
Once the user fill the email & password, it is redirected to the the register page. (https://my-app.com/register)
But on this page, I cannot do anything.
When customers submit form on this page, I need to save those data.
But on this page, I cannot get the userID on Auth0, or cannot use getAccessTokenSilently method from React Auth0 package.

If you can let me know the way to get Auth0 userID on this page, it would be very helpful.

I wanted to use this endpoint to update user metadata : Auth0 Management API v2
PATCH /api/v2/users/{id}

But I couldn’t make it work because I couldn’t get user ID on post login action event.

Thank you.

Hi @david.guodev17,

Thank you for your reply.

There is the option to pass the data back to the Action and store them on the user’s user_metadata.

Please note that the property to get the user_id from the Post Login Action event object is event.user.user_id.

If you have any further questions, please feel free to reach out.

Thank you.