Demers94
2 years ago

[Socialite] How to handle providers that don't return the email

Posted 2 years ago by Demers94

I'm using Socialiate and SocialiteProviders to give our users a bunch of OAuth options.

Currently, when we login a user using a social provider, we attempt to find an existing user in our database matching that provider and ID combination. If there isn't, then we create the new account on the fly using the email address.

The issue is with the providers that don't return the email address, like Twitter and Steam. If we can't find an existing user with those credentials, then we have no way of creating a new account without an email address (and we don't want to make the email address optional/nullable).

What's the best way to handle this?

I was thinking of just showing the providers that support the email (like Facebook and Github) on the main login/registration page, and adding the other options on the user profile (so that they can link them to their existing account).

There must be a better solution, how do you guys handle this in your applications with Socliate?

Thanks for the help!

Please sign in or create an account to participate in this conversation.