We are going to easily integrate with KnpUOAuth2ClientBundle for Symfony 4. You can read the detail about it, https://github.com/knpuniversity/oaut...
For further actions, you may consider blocking this person and/or reporting abuse
Hi,
I have tried this for Symfony 4.2.2.
When i edit my security.yaml, i have this error : " Unrecognized option "knpu_oauth2_client" under "security". Available options are "access_control", "access_decision_manager", "access_denied_url", "always_authenticate_before_granting", "encoders", "erase_credentials", "firewalls", "hide_user_not_found", "providers", "role_hierarchy", "session_fixation_strategy". "
I don't know how can i solve it ?
Hi ,
Did you found a solution for this problem , cause i have the same and couldn't fix it ?
Hi fellas,
Thank you for reply, I tried to get same error and I did as I said in this article and I got same error. I found the solution.
You have to insert these lines. security and knpu_oauth2_client must be same level for yaml format. Don't push knpu_oauth2_client to under security section.
Hi, thanks a lot for this tutorial, I followed all the steps but I still have this error :
{
"status": false,
"message": "User not found!"
}
I tried a var_dump(($this->getUser());
and I get NULL
So I don't know what is wrong, thanks for your help :)
Hi Julien,
Where do you write var_dump($this->getUser()); ?
You should try to write dumping the User into GoogleAuthenticator class and getUser() method? And in my opinion, keep on line-by-line with this way that class.
Ok I'll try this, I was tryin in the Google Controller... probably not the best idea
So I think I'm half way there, I had to change this, so I'm adding users in the bdd via google.
Once again, thanks a lot for you're toturial :)
Don't mention it :) I got happy for you
Hi,
Is it possible for you to explain how to mix a form login (simple page with forms) and the knpu oauth in a api that using lexik and jwt please ? I can log to my api with sending json to the login_check path that send me the jwt token and then use it to play with api route, but in a mixed login, how to implement it to connect with google and receive the jwt token (it is maybe a stupid question but i need to know it)
Thanks for this very great tut
thepracticaldev.s3.amazonaws.com/i...
The App\Security\GoogleAuthenticator::getUser() method must return a UserInterface. You returned App\Entity\User.
I don't know how can i solve it ?
Apparently, you need to implement UserInterface to User Entity class. Open the User entity file and import this line,
class User implement UserInterface
First thank you so much bro for this tutorial It helped me a lot and saved my project but there's one problem ... these infos doen't save to my database directly
Thanks for the answer. What's the matter with the database?
The infos that we brought from google doesn't persist / flush
Is there anything error or what?
This code should insert your user data into your database.
I had a little problem in my code and it worked thanks again , I want to ask you please how can I retrieve the Date of birth
As I read, there is a scope about it. Here you are, the documentation.
developers.google.com/people/v1/ho...
You need to add this scope as the documentation.
googleapis.com/auth/user.birthday....
where shall I add it ?
In fact, I don't know but Could try this? I've changed user_fields line.
Also, check out developers.google.com/+/web/api/re...
It didnt worked :(
HI I thing that something Google changed in past couple days
github.com/thephpleague/oauth2-goo...
so I dont know how to override so I can make it work - until somene fix the bundle.
I check it out the issue, I assume you find a solution, right?
Oh yes sorry I didnt write
in googleController should be
Perfect! Nowadays, I move to Symfony 5, thanks a lot!
Hi,
I implement new symfony security
symfony.com/doc/current/security.html
and now I have this error
Argument 1 passed to Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticator::__construct() must implement interface Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface, instance of App\Security\GoogleAuthAuthenticator given, called in /opt/app/vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php on line 60
Hi,
I have tried this for Symfony 5. I cannot do the authentication because when I have done the login with google it returns {"status":false,"message":"User not found!"}.
I cannot understand what's wrong, can you help me?
Hi @marcomorain
Actually, I haven't moved to Symfony 5 version. However, it might be an easy way because most things got easier regarding security on that version as I know.
Thank you, very quickly helped set up!
I'm glad to hear that :)
Hi,
I don't know exactly why I am facing this error
error
<< Attempted to load class "AbstractGuardAuthenticator" from namespace "Symfony\Component\Security\Guard".
Did you forget a "use" statement for another namespace? >>
Really cool ! Thanks a lot ! Works perfectly for me !
I'm going to try the same with facebook :)
That's superb! I am pleased.
Yes, i integrated Facebook last week. It happened fine :)
Great tutorial everything works great
I'm glad to hear it from you :)
Hey great tuto ! thks !
Can you make a little one for facebook ??? Because I really can't do it....
Tks you :)
Hi,
Thank you for pretty reply :) In fact, there is a document related as you want. Here you are :)
github.com/knpuniversity/oauth2-cl...
@babababou did you success ? Cause I'm following knpuniversity documentation but I feel like I have to be in HTTPS...
Hi,
If I try to login but I dont have gmail account, I get epmty form for login on gmail account, but I want if there is no gmail account to redirect user on other url for log in.
Can you help?
I'm wondering about which purpose you create UserProvider. It looks you didn't use it in Authenticator
There is no OAuth2 client called "google". Available are:
This is what i have. Can someone help me ?
what is excatly the issue? Can you clarify it more?
How can I store the username at session after successful login?