I want to include a Social Login OAuth implementation (Google OAuth) for a specific route.
i.e. goto /login if /specialPageForSignedInUsersOnly
Using knpuniversity/oauth2-client-bundle & and league/oauth2-google
WebserverUserProvider and WebserverUser
I used the following documentation: (amongst others)
On Google login, the Guard authenticator is successfully called to check if authentication needed
The Google controller uses the WebserverUserProvider to return a WebserverUser with the pimcore’s user details (username, password and roles)
However, on next request to /specialPage I expected the user to be allowed in since the user has been authenticated. But it goes back to /login.
From the documentation:
- I expected Symfony to save the Token that comes back from Google. Not sure whether this is being done. Where should I check? If Symfony does not do it, do I need to save the token along with the logged in user’s email?
- I expected Symfony to save the user details in session, then with subsequent calls to /specialPageForSignedInUsersOnly Symfony calls WebserverUserProvider to check whether the user is still the same. This does NOT happen! I think I’m missing something basic.
I haven’t included the code just for brevity. If any details needed happy to provide. Thanks.