Is it possible to use Silhouette without database in Play?

Hi community,

I am developing a web app and the current requirement is to implement user log in/out (authenticate credentials by external service, no register needed), but the strange thing is that there’s no DB and I’m not allowed to deploy DB. So I wonder could I use Silhouette under such condition?



Yes, if you use a social authentication method, then you need no database. You can store the access token returned from the provider, but this is not needed.

Best regards,

Hi Christian,

Sorry for my ambiguity.
It’s technically not a social authentication, I can only use the service to see if the user/password works and nothing else. Under this condition, may I still use Silhouette?


Sure, there are two possibilities. Either you could implement your own authentication provider which checks against your API or you use the credentials provider if you need password hashing on the Silhouette side. In this case the AuthInfoRepository, which you must pass to the CredentialsProvider, can make the API requests for you.

1 Like

Hi Zanecat,

Look here:
— you can replace the handle-auth-results code with your own, and do anything you want. This line:
silhouette.env.eventBus.publish(LoginEvent(user, request))

Hmm and maybe you need to replace this:
with something else too.

I’ve done that, look here: (I eventually do write something to a database though, but that’s me doing it with my own code, not any Silhouette built-in stuff.) — that line (L169) gets the open-auth login result, and does “whatever I want”. That’s Silhouette 4.0 and Play 2.5 though; I’m upgrading right now … trying …

B.t.w. cool username, i.e. zanecat :- ) Gives me many ideas of other new usernames :- )

1 Like

LOL, thanks very much and with pleasure that my name brought you ideas.