# Get social 'provider'

**URL:** <https://community.auth0.com/t/get-social-provider/50719>\
**Category:** JWT.io\
**Tags:** jwt, api, rules\
**Created:** [September 30, 2020, 1:02pm UTC](https://community.auth0.com/t/get-social-provider/50719 "2020-09-30T13:02:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark.hall](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mark.hall/32/12776_2.png) [@mark.hall](https://community.auth0.com/u/mark.hall)\
**Post date:** [September 30, 2020, 1:02pm UTC](https://community.auth0.com/t/get-social-provider/50719/1 "2020-09-30T13:02:01Z")

</div>

Where a user may sign in with one of multiple social identity providers, is it possible to add the provider (.e.g ‘google’) into the access token, perhaps using a rule to do so?

---

<div class="post-metadata">

**Author:** ![vihar.kurama](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vihar.kurama/32/21572_2.png) [@vihar.kurama](https://community.auth0.com/u/vihar.kurama)\
**Post date:** [September 30, 2020, 5:18pm UTC](https://community.auth0.com/t/get-social-provider/50719/2 "2020-09-30T17:18:31Z")

</div>

Hey @mark.hall, I didn’t get your question exactly. But I’m assuming you want to add the providers into different access tokens.

I don’t think you can add different provider into an existing access token. To make this more clear consider this example, an access token issued after a user authenticates to Facebook can be used to call the Facebook Graph API.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [September 30, 2020, 5:23pm UTC](https://community.auth0.com/t/get-social-provider/50719/3 "2020-09-30T17:23:50Z")

</div>

Thanks for the input @vihar.kurama!

If you simply want to see what IDP the user is using to authenticate, you can look at the prefix in the `sub` claim of the token. It should be the users IDP followed by their UUID.

for example:

`google-oauth2|1234567890` is a google user  
`twitter|0987654321` is a twitter user

---

<div class="post-metadata">

**Author:** ![mark.hall](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mark.hall/32/12776_2.png) [@mark.hall](https://community.auth0.com/u/mark.hall)\
**Post date:** [September 30, 2020, 5:57pm UTC](https://community.auth0.com/t/get-social-provider/50719/4 "2020-09-30T17:57:54Z")

</div>

Thanks Dan, that’s all I was after, the name of the provider.  
I take it the same principal will apply with custom OAuth2.0 providers?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [September 30, 2020, 6:27pm UTC](https://community.auth0.com/t/get-social-provider/50719/5 "2020-09-30T18:27:17Z")

</div>

I don’t have an example right in front of me but if I recall correctly it should be the connection strategy param. See the example doc:  
[https://auth0.com/docs/connections/generic-oauth2-connection-examples](https://auth0.com/docs/connections/generic-oauth2-connection-examples)

---

<div class="post-metadata">

**Author:** ![mark.hall](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mark.hall/32/12776_2.png) [@mark.hall](https://community.auth0.com/u/mark.hall)\
**Post date:** [October 1, 2020, 9:12am UTC](https://community.auth0.com/t/get-social-provider/50719/6 "2020-10-01T09:12:32Z")

</div>

Thanks for this. Related, if we link a user account, so they have logged in with Google first time and another social provider another - will interrogating the subject still tell us which one they have logged in with? Or may it be better to get the identities object and look for the one with the latest last\_login?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [October 1, 2020, 3:14pm UTC](https://community.auth0.com/t/get-social-provider/50719/7 "2020-10-01T15:14:04Z")

</div>

It should match this example:

> **[User Account Linking](https://auth0.com/docs/manage-users/user-accounts/user-account-linking)**
>
> Understand how user accounts can be linked in Auth0 from various identity providers.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 16, 2020, 3:14pm UTC](https://community.auth0.com/t/get-social-provider/50719/8 "2020-10-16T15:14:10Z")

</div>

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