def create_token_with_refresh_token(self, data, token_valid_for=180,
                                        refresh_token_valid_for=86400):
        """ Create an encrypted JWT with a refresh_token """
        refresh_token = None
        refresh_token = jwt.encode({
            'exp':
                datetime.utcnow() +
                timedelta(seconds=refresh_token_valid_for)},
            self.app_secret).decode("utf-8")
        jwt_token = jwt.encode({
            'data': data,
            'refresh_token': refresh_token,
            'exp': datetime.utcnow() + timedelta(seconds=token_valid_for)},
            self.app_secret)
        return Security.encrypt(jwt_token)
def create_token_with_refresh_token ( self , data , token_valid_for = 180 , refresh_token_valid_for = 86400 ) : refresh_token = None refresh_token = jwt . encode ( { 'exp' : datetime . utcnow ( ) + timedelta ( seconds = refresh_token_valid_for ) } , self . app_secret ) . decode ( "utf-8" ) jwt_token = jwt . encode ( { 'data' : data , 'refresh_token' : refresh_token , 'exp' : datetime . utcnow ( ) + timedelta ( seconds = token_valid_for ) } , self . app_secret ) return Security . encrypt ( jwt_token )
Create an encrypted JWT with a refresh_token