Pr0Ger/PyAPNs2

TypeError: sign() missing 1 required positional argument: 'algorithm'

Fiser12 opened this issue · 1 comments

I have this error when I try to launch the push notification, could you help me with this error? anyone know how to fix it?

web_1 | Exception in thread Thread-1: web_1 | Traceback (most recent call last): web_1 | File "/app/app/services/push_notifications/apns_htttp2_service.py", line 53, in send_push_notification web_1 | client.send_notification(device_token, payload, bundle_id, expiration=expiry) web_1 | File "/usr/local/lib/python3.8/site-packages/apns2/client.py", line 93, in send_notification web_1 | stream_id = self.send_notification_async(token_hex, notification, topic, priority, expiration, collapse_id) web_1 | File "/usr/local/lib/python3.8/site-packages/apns2/client.py", line 137, in send_notification_async web_1 | auth_header = self.__credentials.get_authorization_header(topic) web_1 | File "/usr/local/lib/python3.8/site-packages/apns2/credentials.py", line 60, in get_authorization_header web_1 | token = self._get_or_create_topic_token() web_1 | File "/usr/local/lib/python3.8/site-packages/apns2/credentials.py", line 89, in _get_or_create_topic_token web_1 | jwt_token = jwt.encode(token_dict, self.__auth_key, web_1 | File "/usr/local/lib/python3.8/site-packages/jwt/api_jwt.py", line 64, in encode web_1 | return super(PyJWT, self).encode( web_1 | File "/usr/local/lib/python3.8/site-packages/jwt/api_jws.py", line 114, in encode web_1 | signature = alg_obj.sign(signing_input, key) web_1 | File "/usr/local/lib/python3.8/site-packages/jwt/algorithms.py", line 359, in sign web_1 | der_sig = key.sign(msg, ec.ECDSA(self.hash_alg())) web_1 | TypeError: sign() missing 1 required positional argument: 'algorithm'

I fix this error passing this parameter to Token Credentials object
encryption_algorithm='HS256'