Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

AddTokenValidityKeyAsync not saving in AbpUserToken #11216


User avatar
0
mark.montesa created
  • What is your product version? 8.2
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

Hi, just found out that AddTokenValidityKeyAsync method is not saving the token on the AbpUserToken table. May I have some input on why it suddenly stop working?

Thanks.


21 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mark.montesa

    How can we reproduce this problem ? Could you share the steps ?

  • User Avatar
    0
    mark.montesa created

    We have multitenant setting with different database and multi instance on our production. We are not able to save token validity on database using AddTokenValidityKeyAsync method.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This method basically adds the token to user.Tokens list. Could you share how do you use it in your project ? Is it the default usage in TokenAuthController's CreateJwtClaims method ?

  • User Avatar
    0
    mark.montesa created

    Hi,

    "This method basically adds the token to user.Tokens list." --- Yes that correct it adds the token to user.Tokens list, but the weird thing it does not reflect on the UserToken table.

    " Is it the default usage in TokenAuthController's CreateJwtClaims method ?" --- Yes were using the default CreateJwtClaims with no update on the method.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mark.montesa

    Sorry for the late reply. We will check this and get back to you in a short time.

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @mark.montesa

    I tested in your version, it is working. Could you give me more information?

  • User Avatar
    0
    mark.montesa created

    hi m.aliozkaya,

    Yes already tested it on vanilla version of ANZ 8.2 and its working. Do you have any idea on what possible changes we have made that makes it stop working. The problem is we cannot track the update we have that make it stop working. Any inputs that put us on the right path for debugging the issue is very appreciated thanks.

    We have initially have ANZ 7 then update it to 8.2

    Thanks

  • User Avatar
    1
    ismcagdas created
    Support Team

    Hi @mark.montesa

    Is it possible to share your project with us via email ? We can cehck your source code and try to find the problem. It is hard to detect the problem without seeing the source code.

  • User Avatar
    0
    mark.montesa created

    hi @ismcagdas,

    I'll share it to you via email. May I know your email address.

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @mark.montesa

    You can send your source code to this email: [email protected]

  • User Avatar
    0
    mark.montesa created

    Hi m.aliozkaya I just sent a copy of source code on [email protected].

    Thanks in advance

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @mark.montesa we will check it

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @mark.montesa,

    I can't migrate migrations to my local database. I have errors about same tables. Like AbpWebhookEvents table exists in your database.

  • User Avatar
    0
    mark.montesa created

    Hi @m.aliozkaya,

    Hi sorry about that. Ill compile our migrations files then will send it to you. Ill create a single migration file. You can disregard the existing migration files.

    Thanks,

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks, we got the migration file and will cehck it.

  • User Avatar
    0
    mark.montesa created

    hi @m.aliozkaya, @ismcagdas,

    Any update on this. Any feedback is appreciated thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mark.montesa

    We checked the problem but we couldn't identify the problem yet.

  • User Avatar
    0
    mark.montesa created

    hi @m.aliozkaya, @ismcagdas,

    any findings you can share with us? as of now I put a code that will force saving of AbpUserTokens on the database.

    thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @mark.montesa

    I have found the problem, it is because of the line below in your DbContext;

    ChangeTracker.AutoDetectChangesEnabled = false;
    

    Since the token is added to the Tokens collection of User entity, the change is not detected becaue of this line.

  • User Avatar
    0
    mark.montesa created

    Hi @ismcagdas,

    Thank you for your findings. We will check it.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks.