# Best practices for Social Login

**URL:** <https://community.auth0.com/t/best-practices-for-social-login/42576>\
**Category:** Get Help\
**Tags:** reset-password\
**Created:** [May 7, 2020, 4:57pm UTC](https://community.auth0.com/t/best-practices-for-social-login/42576 "2020-05-07T16:57:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![api-nick](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/api-nick/32/19235_2.png) [@api-nick](https://community.auth0.com/u/api-nick)\
**Post date:** [May 7, 2020, 4:57pm UTC](https://community.auth0.com/t/best-practices-for-social-login/42576/1 "2020-05-07T16:57:33Z")

</div>

I’ve recently enabled a few of the social logins - which is great, it seems to really speed up the sign-in / sign-up process.  
The trouble is now, I’m getting returning users coming back, forgetting which social login they used and trying to use the password reset flow to gain access. Given they have no password with us, this does not work, and they get frustrated and require support.  
I am going to enable the account linking app to at least mitigate some of the issues, but even after I do this, it won’t solve this exact problem of a user who has never created a username-password account in our tenant.  
Is there a way to automatically create a linked account from a social login, or some other way to recognize an existing social login user and prompt them?

---

<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:** [May 8, 2020, 10:33pm UTC](https://community.auth0.com/t/best-practices-for-social-login/42576/3 "2020-05-08T22:33:22Z")

</div>

Hi @api-nick,

There isn’t a built in function to handle this type of UX, but you could build something in rules.

When a social user logs in for the first time, you can create a username/pw account for them with the same email and link the accounts. Then, if they try to do a pw reset, they should be able to get the email reset link and go from there.

Does that make sense?

---

<div class="post-metadata">

**Author:** ![api-nick](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/api-nick/32/19235_2.png) [@api-nick](https://community.auth0.com/u/api-nick)\
**Post date:** [May 8, 2020, 10:40pm UTC](https://community.auth0.com/t/best-practices-for-social-login/42576/4 "2020-05-08T22:40:33Z")

</div>

Ah yes, that makes sense.  
I see the create user API, and I know there’s an API to link accounts too. Presumably I can either create a random dummy password or not specify one at all?

---

<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:** [May 11, 2020, 5:36pm UTC](https://community.auth0.com/t/best-practices-for-social-login/42576/5 "2020-05-11T17:36:31Z")

</div>

You must specify a password. In this case, you could add a random password as a placeholder.

This library is available in rules, and is very straight forward:

> **[secure-random-password](https://www.npmjs.com/package/secure-random-password)**
>
> Generate passwords using a cryptographically-strong source of randomness. Latest version: 0.2.3, last published: 2 years ago. Start using secure-random-password in your project by running \`npm i secure-random-password\`. There are 23 other projects in...

Hopefully that helps!

---

<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:** [May 26, 2020, 5:36pm UTC](https://community.auth0.com/t/best-practices-for-social-login/42576/6 "2020-05-26T17:36:36Z")

</div>

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