Category : jwt

Currently i create in api platform jwt token with custom symfony controller, provider and encode with JWTEncoderInterface, use authentification come from external api. I have users but not password in my database. How implement refresh token with that system? security.yml providers: # used to reload user from session & other features (e.g. switch_user) user_provider: id: ..

Read more

I am using for the first time API platform with symfony (Symfony CLI version : v2.21.2). I created a USER entity and i am using jwt for authentication. I followed the steps as shown here https://api-platform.com/docs/core/jwt/ but when i post a request : curl -X POST -H "Content-Type: application/json" http://127.0.0.1:8000/api/login_check -d ‘{"username":"username1", "password":"password1"}’ to get ..

Read more

I am using for the first time API platform with symfony (Symfony CLI version : v2.21.2). I created a USER entity and i am using jwt for authentication. I followed the steps as shown here https://api-platform.com/docs/core/jwt/ but when i post a request : curl -X POST -H "Content-Type: application/json" http://127.0.0.1:8000/api/login_check -d ‘{"username":"username1", "password":"password1"}’ to get ..

Read more

I am working on a Symfony application. This application receive requests from different vendors and each of them do requests with a certain JWT token. The token is ok. My lexik configuration is ok. Passphrase is ok. … but I always receive {"code":401,"message":"Invalid JWT Token"} Debugging in lexik code I can see the error is ..

Read more

In the services.yaml file there is this config : services: # … pulsekb_api.event.authentication_failure_listener: class: AppEventListenerAuthentificationEventListener arguments: [ ‘@translator’,’@service_container’ ] tags: – { name: kernel.event_listener, event: lexik_jwt_authentication.on_authentication_failure, method: onAuthenticationFailureResponse use LexikBundleJWTAuthenticationBundleEventAuthenticationFailureEvent; use LexikBundleJWTAuthenticationBundleEventAuthenticationSuccessEvent; use LexikBundleJWTAuthenticationBundleEventJWTCreatedEvent; use PsrContainerContainerInterface; use SymfonyComponentConsoleInputInputInterface; use SymfonyComponentHttpFoundationJsonResponse; use SymfonyComponentHttpFoundationRequest; use SymfonyComponentDependencyInjectionContainer; use AppUtilsConstantSrv; use SymfonyContractsTranslationTranslatorInterface; /** * Class AuthentificationEventListener * @package ParasolCommunBundleEventListener ..

Read more

With the JWT, I manage to get the token of a User who has the ROLE_ADMIN but when I want to delete a user, it says: "Full authentication is required to access this resource." Here is a piece of my code in the User class: ** * @ORMEntity(repositoryClass=UserRepository::class) * @ApiResource( * normalizationContext={ * "groups"={"availabilities_read"} * ..

Read more

I’m making login two-factor feature on a project which using LexikJWTAuthenticationBundle (https://github.com/lexik/LexikJWTAuthenticationBundle). I use scheb/2fa bundle (https://github.com/scheb/2fa), but I don’t know how to combined it with JWT and use it in rest api project. I read the scheb/2fa documentation, but it’s pretty general and simple, and also says nothing to apply to rest api project. ..

Read more