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

Can't configure refresh token with SF6 #330

Open
sanchobouillant opened this issue Jun 27, 2022 · 6 comments
Open

Can't configure refresh token with SF6 #330

sanchobouillant opened this issue Jun 27, 2022 · 6 comments

Comments

@sanchobouillant
Copy link

Hi everyone,

I try to configure the bundle with SF6 AND php8.1

routes.yaml

gesdinet_jwt_refresh_token:
  path: /auth-token/refresh
  controller: gesdinet.jwtrefreshtoken::refresh

security.yaml

    login:
      pattern: ^/auth-token
      user_checker: App\Security\UserChecker
      stateless: true
      json_login:
        check_path: /auth-token
        success_handler: lexik_jwt_authentication.handler.authentication_success
        failure_handler: lexik_jwt_authentication.handler.authentication_failure

    refresh:
      pattern: ^/auth-token/refresh
      user_checker: App\Security\UserChecker
      stateless: true
      refresh_jwt: ~
      provider: app_user_provider

    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false

    main:
      lazy: true
      provider: app_user_provider
      user_checker: App\Security\UserChecker
      stateless: true
      jwt: ~
      entry_point: jwt

With that code I have

Attempted to load class \"AbstractGuardAuthenticator\" from namespace \"Symfony\\Component\\Security\\Guard\".\nDid you forget a \"use\" statement for another namespace?

If I remove the controller part from the routes.yaml I have:

Unable to find the controller for path "/auth-token/refresh". The route is wrongly configured.

What did I missed in my configuration?

@programmador
Copy link

Try to remove controller: from routes. It's non intended for usage with recent SF versions.
Also add provider to a firewall
#307 (comment)

@sanchobouillant
Copy link
Author

Whenb I remove the controller and add the provider. I have

Unable to find the controller for path \"/auth-token/refresh\". The route is wrongly configured.

security.yaml

    api_token_refresh:
      pattern: ^/auth-token/refresh
      stateless: true
      provider: app_user_provider
      refresh_jwt: ~

routes.yaml

api_refresh_token:
  path: /auth-token/refresh

@boxedcode
Copy link

@sanchobouillant Did you ever find a solution for this? I'm also facing the same issue.

@fico7489
Copy link

same here

@yo1nick
Copy link

yo1nick commented Aug 3, 2023

Remove config/routes/gesdinet_jwt_refresh_token.yaml

@sanchobouillant
Copy link
Author

sanchobouillant commented Aug 4, 2023

It work but there are some deprecated warning
routes.yaml:

api_login_check:
  path: /auth-token

gesdinet_jwt_refresh_token:
  path: /api/token/refresh

security:

    login:
      pattern: ^/auth-token
      user_checker: App\Security\UserChecker
      stateless: true
      json_login:
        check_path: /auth-token
        success_handler: lexik_jwt_authentication.handler.authentication_success
        failure_handler: lexik_jwt_authentication.handler.authentication_failure

    refresh:
      pattern: ^/auth-token/refresh
      user_checker: App\Security\UserChecker
      stateless: true
      refresh_jwt: ~
      provider: app_user_provider

    main:
      lazy: true
      provider: app_user_provider
      user_checker: App\Security\UserChecker
      stateless: true
      jwt: ~
      entry_point: jwt
      refresh_jwt:
        check_path: gesdinet_jwt_refresh_token

gesdinet_jwt_refresh_token:

gesdinet_jwt_refresh_token:
    refresh_token_class: App\Entity\RefreshToken
    single_use: true

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

No branches or pull requests

5 participants