scalaplayframeworksecuresocial

Scala securesocial: providerId for an email registered user?


In securesocial ( https://github.com/jaliss/securesocial ), you have to override the

def findByEmailAndProvider(email: String, providerId: String): Future[Option[BasicProfile]]

method of the UserService class ( https://github.com/jaliss/securesocial/blob/master/module-code/app/securesocial/core/services/UserService.scala )

But what is the providerId of a user who is registered through simple email registration (not using a social account) ?

I found no description of what providerId is in the doc or in the code itself. My understanding is that the providerId is a string like "twitter", "facebook" or "google" that identifies the social network the user used to connect.

Should I use an arbitrary string that represents my web application ("myapp" or something like that) for email registered users?

Actually, I think I don't even understand why providerId is a parameter to this method. I don't see what it is used for in this context. If the user uses an email address to connect, isn't it already known that they're not connecting through facebook/twitter/google or whatever?

Thanks for your help.


Solution

  • We used [userpass] as the providerId for user registering with email. And as per my understanding this method has providerId as a parameter because, there can be multiple entries with single email(i.e for different social accounts and email registration). And when a user tries to login by a certain method(either social or email), you need a way to differentiate records in DB. For example user registers through email and tries to login through facebook, then this will help you to identify that user's facebook info is not there and he first needs to connect his facebook account.