Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got Access Token but auth fails. Configuration issue? #10

Closed
vladimir-light opened this issue May 20, 2022 · 3 comments
Closed

Got Access Token but auth fails. Configuration issue? #10

vladimir-light opened this issue May 20, 2022 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@vladimir-light
Copy link

Any improved docs to get it work or how to configure my firewalls?

I have several firewalls configured, and they worked fine with old "vanilla" FOSOAuthServerBundle.

firewalls:
     ...
     oauth_token:
          pattern:    ^/oauth/v2/token
          security:   false
          
     oauth_authorize:
          pattern:    ^/oauth/v2/auth
          custom_authenticator: .... 
          
     api:
          pattern: ^/api/v1/
          fos_oauth:  true 
          stateless:  true        

But with this bundle, I do get working access-token (regardless of grant_type I use) but authentication with this token fails → UserNotFoundException

FOS\OAuthServerBundle\Security\Authenticator\Oauth2Authenticator::authenticate() get hit and returns a valid new SelfValidatingPassport() but then, for some reason, EntityUserProvider from Symfony\Bridge\Doctrine\Security\User comes into play and, of course, do not find any User in UserRepo by client_public_id ( https://github.com/klapaudius/FOSOAuthServerBundle/blob/3.0/Security/Authenticator/Oauth2Authenticator.php#L90 )

In my case, I could not step in into FOS\OAuthServerBundle\Security\Authentication\Provider\OAuthProvider while debugging.

Do I miss something?

@klapaudius klapaudius self-assigned this Aug 4, 2022
@klapaudius
Copy link
Owner

Hi,

I was working on the Symfony 6 compliancy so I've just installed the bundle from scratch. I completely agree that the doc was out of date.

This is fixed now.

Thank you for the feedback.

@klapaudius klapaudius added help wanted Extra attention is needed question Further information is requested and removed help wanted Extra attention is needed labels Aug 5, 2022
@drekinov
Copy link

drekinov commented Sep 2, 2022

I have same issue with v3.1.2 (last supporting 5.4 with new authentication).
I figured out the same that Oauth2Authenticator creates UserBadge with Oauth client_public_id and then mine Userprovider is failing to find user.
What i am missing from documentation ?

@Methraen
Copy link

Methraen commented Sep 16, 2022

I get the very same problem : UserBadge with Oauth client_public_id instead of getting user's identifier (email in my case) so auth fails... any ideas (with v4.0.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants