Closed abelardolg closed 4 years ago
I have deeply navigated through your code and I think the JWT token is generated with the GetTokenHandler (as its proper name indicates).
Could you gently tell me if I am correctly doing it?:
I would like to know if I am wrong with this roadmap, thanks.
Best regards.
In theory that was a feature, not a bug. Here the explanation:
Web and Api are different areas for the security component. Even if you can share the user provider between those two, still different areas with different auth methods. See here https://github.com/jorge07/symfony-5-es-cqrs-boilerplate/blob/master/config/packages/security.yaml#L35 https://github.com/jorge07/symfony-5-es-cqrs-boilerplate/blob/master/config/packages/security.yaml#L43
Is up to you to change this behavior depending of your use case or context of your application. For example, if I'm building a site with symfony and twig, I'll probably
1- Not use an /api/ area and just keep thing done with the proper verbs like it's done in SignuUpController. 2- If want to use the api for whatever reason and use the same auth mechanism, just simply modify the security config to include api in your secure area and delete the other one.
I hope you find this helpful
Closing :)
Hi there,
I think a JWT token was created since I could logged in with my user.
Is not enough to login with my user to get a valid JWT token?
What's wrong?
Best regards.