Hey guys, I'm having problems with the custom clai...
# support-questions-legacy
e
Hey guys, I'm having problems with the custom claims. I have a custom claim with key
2fa_completed_or_absent
. Everything is okay after I first log in, but after my access token expires (it is set to expire in 15 min) and I refresh my token there is a problem - I get this error from protected API endpoints:
Copy code
json
{
    "message": "invalid claim",
    "claimValidationErrors": [
        {
            "id": "2fa_completed_or_absent",
            "reason": {
                "message": "wrong value",
                "expectedValue": true,
                "actualValue": false
            }
        }
    ]
}
When I try to decode the access token I can see that it contains the my custom claim and its value is correct:
Copy code
json
{
  "2fa_completed_or_absent": {
    "v": true,
    "t": 1666271203895
  }
}
Do you think validation fails because of the timestamp? How do I avoid this?
Maybe I should change this function to change the TTL of the claim?
Copy code
python
async def get_global_claim_validators(
        user_id: str,
        claim_validators_added_by_other_recipes: list[SessionClaimValidator],
        user_context: Dict[str, Any],
):
    return claim_validators_added_by_other_recipes + [SecondFactorCompletedOrAbsentClaim.validators.has_value(True)]
Oh sorry, looks like the value is actually false
Copy code
json
{...
"2fa_completed_or_absent": {
    "v": false,
    "t": 1666273248592
}
...}
But why it becomes
False
after token refresh?πŸ€”
r
Hey! If the fetch_value function of the claim just returns false, then this used to happen in older versions of the SDK
Can you please update to the latest version of the SDKs and see if this solves the issue?
e
I am currently using
supertokens-python==0.11.0
, I'll try to update it to the latest version now
r
Sounds good
e
Well, looks like
supertokens-python==0.11.0
is already latest version πŸ˜…
r
Oh no it’s 0.11.3
e
oh sorry, one sec
SDK upgrade fixed the issue πŸ₯³ thank you @rp_st πŸ™‚
r
Great!
You should also update the frontend SDK by the way.