markitosgv/JWTRefreshTokenBundle

Issue in entity for refresh tokens

balvirsingh opened this issue · 7 comments

gesdinet_jwt_refresh_token.yaml
Code is -
gesdinet_jwt_refresh_token:
refresh_token_class: App\Entity\JwtRefreshToken

Entity file code is -
JwtRefreshToken.php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken;

/**

  • This class extends Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken to have another table name.
  • @Orm\Entity
  • @Orm\Table("jwt_refresh_token")
    */
    class JwtRefreshToken extends RefreshToken
    {
    }

But now issue showing that -

image

If I set primary Id in entity file then it ask to implement the interface.
After implement interface and decalare all the methods of interface in entity file then again it gives error of mapping repository with interface.
php version - 7.4
symfony version - 5.2.5
Bundle version - v1.0.0-beta4

symfony version - 5.2.5
Bundle version - v1.0.0-beta4

Please update to Symfony 5.4 and the bundle's 1.1 release and check again.

Thanks everyone, It works with version 0.12.

Now I have a query -
I want to invalidate/expire the old jwt token when generate new token with refresh token.
Currently, Both old and new token are working.

Thanks in advance.

You'd have to do something to track issued JWTs in your app, out-of-the-box the LexikJWTAuthenticationBundle doesn't have any services to deal with that.

Having the same issue on v1.1.1.
Running Symfony v6.0.*
PHP 8.1.

Same issue SF 5.4 v1.1.1
Are we missing annotations on the Base Class?

Are we missing annotations on the Base Class?

No. The bundle provides an XML mapping for the base classes for the MongoDB ODM and ORM integrations. Generally, that mapping should automatically be registered through whichever Doctrine bundle applies to your object manager and Symfony's Doctrine Bridge component as long as you have the automapping option for your object manager enabled. Or, if you don't want automapping enabled, you'd need to register the bundle mappings explicitly in your app's config.

Are we missing annotations on the Base Class?

No. The bundle provides an XML mapping for the base classes for the MongoDB ODM and ORM integrations. Generally, that mapping should automatically be registered through whichever Doctrine bundle applies to your object manager and Symfony's Doctrine Bridge component as long as you have the automapping option for your object manager enabled. Or, if you don't want automapping enabled, you'd need to register the bundle mappings explicitly in your app's config.

Auto mapping was indeed not on. (project upgraded from SF4).
After enabling https://symfony.com/doc/current/reference/configuration/doctrine.html#custom-mapping-entities-in-a-bundle it works :)