Hey , I tried using the code snippet mentioned in ...
# support-questions-legacy
t
Hey , I tried using the code snippet mentioned in the doc https://supertokens.com/docs/userroles/protecting-routes
Copy code
class PriceClass(Resource):
    # @verify_session_decorator([Role.USER.value, Role.ADMIN.value])
    def get(self, submission_id):
        try:
            session: SessionContainer = g.supertokens
            roles = session.sync_get_claim_value(UserRoleClaim)
            if roles is None or "admin" not in roles:
                raise_invalid_claims_exception(
                    "User is not an admin",
                    [ClaimValidationError(UserRoleClaim.key, None)],
                )
            return service.get_price_class_info(submission_id)
        except FMEntityNotFoundException as e:
            return {"message": f"{e}"}, 404
This is my code snippet , it gives error as there is no supertokens attribute in g . I am using version supertokens-python==0.18.3
4 Views