def get_auth_token(self, user_payload):
        """
        Create a JWT authentication token from ``user_payload``

        Args:
            user_payload(dict, required): A `dict` containing required information
                to create authentication token
        """
        now = datetime.utcnow()
        payload = {
            'user': user_payload
        }
        if 'iat' in self.verify_claims:
            payload['iat'] = now

        if 'nbf' in self.verify_claims:
            payload['nbf'] = now + self.leeway

        if 'exp' in self.verify_claims:
            payload['exp'] = now + self.expiration_delta

        if self.audience is not None:
            payload['aud'] = self.audience

        if self.issuer is not None:
            payload['iss'] = self.issuer

        return jwt.encode(
            payload,
            self.secret_key,
            algorithm=self.algorithm,
            json_encoder=ExtendedJSONEncoder).decode('utf-8')
def get_auth_token ( self , user_payload ) : now = datetime . utcnow ( ) payload = { 'user' : user_payload } if 'iat' in self . verify_claims : payload [ 'iat' ] = now if 'nbf' in self . verify_claims : payload [ 'nbf' ] = now + self . leeway if 'exp' in self . verify_claims : payload [ 'exp' ] = now + self . expiration_delta if self . audience is not None : payload [ 'aud' ] = self . audience if self . issuer is not None : payload [ 'iss' ] = self . issuer return jwt . encode ( payload , self . secret_key , algorithm = self . algorithm , json_encoder = ExtendedJSONEncoder ) . decode ( 'utf-8' )
Create a JWT authentication token from ``user_payload``

        Args:
            user_payload(dict, required): A `dict` containing required information
                to create authentication token