Auth0 Home Blog Docs

React + Auth0: How to get a users provider + connection type?

Hello everyone, what I am trying to do is create a CRUD profile page for the users on my site. However I am running into the problem that I cannot tell if my users logged in from google vs. Apple vs. traditional email & password auth. When I invoke a user from auth0, I only get the basic fields such as email family_name etc.

Anyone know of a way to get the additional data I need?

Hi @SSelke,

Thanks for joining us in the Auth0 Community!

You could add the connection into the id_token in a rule via a custom claim.

Something like this:

function (user, context, callback) {
  const namespace = 'https://myapp.example.com/';
  context.idToken[namespace + 'connection'] = context.connection;
  callback(null, user, context);
}

Let me know if this is what you were looking for.

Thanks,
Dan

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.