How to find from which connection the user signed in

I would like to know is there any method to find which connection the signed-in user used to sign in. For instance, how can we know whether user signed in using Facebook or Google or Auth0 database.


Welcome to the Auth0 Community, @hiran.amarasinghe!

The most straightforward way to check this would be to take a look at the user’s profile from your Auth0 Dashboard or just take a look at your tenant logs. For example, this is what you would see from the user’s profile:

If you are interested in retrieving that data programmatically and not via the Auth0 Dashboard, this could be accomplished via our Management API. I can think of a couple of endpoints that should do the job:

You would call those endpoints filtering by “type”: “s” and then you could look at the “connection” attribute.

I hope this helps.

1 Like

Hi @Ale,
Thanks a lot for your quick clarification. However, that does not seems to solve my problem as I need to know the connection information at the event of user sign in. After explore further, I was able to find two solutions

  • Identity token “sub” claim. The “sub” claim holds information related to the connection . For instance, “sub”: “auth0|602c4f4092156600685770ad”. From this we could derive whether it’s auth0, google or face book connection
  • Add custom claim in id token via custom rule. I used the rule “Add attributes to a user for specific connection” and edited as follows.

function addAttributes(user, context, callback) {
context.idToken[‘’] = context.connection;
callback(null, user, context);
Here, I could get more accurate details related to the connection

Hope this would help any one


1 Like