php - Symfony2 Google sign-in without FOS User Bundle and HWIOAuth Bundle -
i'm having hard time figuring out how in symfony 2.8 authenticate user using google oauth sign in. avoid hwioauthbundle because not handle registration, "connect" functionality doesn't work unless hack used - i'd love avoid making mess in vendor directory on each node i'll run it. because of custom users hierarchy / model avoid fosuserbundle, couldn't find reliable way work doctrine's sti , fosuserbundle.
the workflow need implement:
user presses "sign in google" button
gets redirected google oauth page
user redirected callback url, e.g. /oauth/login
database checked existence of user (by google id / email)
if user exists, he's authenticated , token populated user, otherwise he's redirected registration page populated data received google additional fields each "local" account requires
now, please correct me @ places i'm wrong:
- i need route used button url - let's /oauth/google-signin
- the controller executed route redirect user google oauth
- then need custom auth factory (with either http or preauth position, didn't figure out yet) along auth provider , auth listener
- i need route used callback - let's /oauth/google-login , route should configured login_path firewall authentication (?)
- when user redirected /oauth/google-login url listener calls auth factory (creating custom token response) , after that, provider executed (it's authenticate method) on token, checking database user
i'm not sure if missed here, that's why wanted ask perhaps done before or know how it. must security component 1 i'm not familiar with, because point used fosuserbundle , sonatauserbundle handle authentication things.
another thing didn't yet figure out - when / how redirect user has no account registered, guess using http / preauth position factory make controller associated /oauth/google-login url executed , here can handle redirect?
Comments
Post a Comment