Comments (4)
Hey @emiliosa!
Hmm, I can see a few possible problems:
-
public function checkCredentials
needs toreturn true;
. Without that, Guard will think that your authentication has failed -
Remove the
public function createAuthenticatedToken
method - this is implemented in a base class. By having this, but empty, it should break things. -
If you change these things, and it still doesn't work, let me know: it's quite possible that authentication IS successful, but your system is having problems reloading the user from the session. To know if this is a problem, you can change the
intercept_redirects
config totrue
temporarily (https://github.com/symfony/recipes/blob/fedaf4a81d15d182efa02733db5703bc35e4024d/symfony/web-profiler-bundle/3.3/config/packages/dev/web_profiler.yaml#L3). Then, after logging in with Google, the system will "stop" before redirecting you on success. On this "stopped" page, you will see the web debug toolbar. You can see if you are authenticated or anonymous. If you ARE authenticated... but then become anonymous after following the redirect, then you will know there is a problem reloading the user from the session (and I can help describe the solution).
Cheers!
from oauth2-client-bundle.
Hi, thanks for the quick reply, i was able to fix doing step 1 and 2, now i can login with any user vĂa google.
Thanks!
from oauth2-client-bundle.
Hi Ryan, I have this error:
" 3) If you change these things, and it still doesn't work, let me know: it's quite possible that authentication IS successful, but your system is having problems reloading the user from the session. To know if this is a problem, you can change the intercept_redirects config to true temporarily (https://github.com/symfony/recipes/blob/fedaf4a81d15d182efa02733db5703bc35e4024d/symfony/web-profiler-bundle/3.3/config/packages/dev/web_profiler.yaml#L3). Then, after logging in with Google, the system will "stop" before redirecting you on success. On this "stopped" page, you will see the web debug toolbar. You can see if you are authenticated or anonymous. If you ARE authenticated... but then become anonymous after following the redirect, then you will know there is a problem reloading the user from the session (and I can help describe the solution)."
Do you know tha cause? Thanks for your help.
from oauth2-client-bundle.
Hey @diegogazzolo!
Yes, I know this error VERY well :). For some reason, there is a problem deserializing your User object from the session.
First, if you have a serialize()
method on your User
object. Remove it. It could be the problem. Basically, at the beginning of each request, your User object is loaded from the session. Then, Symfony queries for a fresh User object from the database and compares the one from the session with the "fresh" User object. If they are "different", for security reasons, you are logged out. This can happen if you have a serialize()
method on User
and aren't serializing enough stuff. It can also easily happen if you're implementing the AdvancedUserInterface
. Here is the logic Symfony uses to compare the users: https://github.com/symfony/symfony/blob/7135aa43380c26a38524a045b42414efb45cf48f/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php#L241
Let me know if that helps!
from oauth2-client-bundle.
Related Issues (20)
- Invalid state parameter passed in callback URL. Azure HOT 1
- How can I use the implementation as a dynamically multi-tenant application? HOT 2
- How is OAuth2PKCEClient supposed to work? HOT 2
- Return Groups in Access Token HOT 1
- Google and facebook log in not working with Symfony 5.4
- Telegram login not working with custom provider HOT 1
- User is not authenticating after registering with facebook/google.
- Google provider doesn't allow setting prompt option HOT 2
- Allow defining the default scope for all clients
- json_login + GoogleAuthenticator
- How to get the authenticator to protect all routes if not logged in? HOT 1
- Redirection to login page if not authenticated not working HOT 4
- Does anyone know if this is vulnerable to this hack, token switching
- connect client to server type generic
- test
- <script>alert("asd")</script>
- Change examples to use #[Route()] attributes HOT 1
- Error fetching OAuth credentials: "Missing required parameter [code_verifier]. HOT 3
- SaveAuthFailureMessage trait incompatible with symfony 7
- How to use Google login on Symfony which is used on Apache2 Reverse Proxy? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. đđđ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â¤ď¸ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oauth2-client-bundle.