feat: add token support for client manager #213
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #98
Description
This PR adds support for JWT token based clients to the client manager.
We are using
apns2
to send Push Notifications to different applications (multiple team ids, multiple APNS keys, etc).We have been using this PR from @bdandy in production for months without any issue:
#160
But we need to upgrade
apns2
to the latest version in order to fix a known CVE in github.com/dgrijalva/jwt-go.This PR ports #160 on
master
and adds tests.More info
Using a client manager for token based clients is important in order to reuse connections as much as possible.
Also, Apple documentation clearly states:
For now, we use the token as the cache key, but we might want to test using the Team ID in order to respect what is recommanded by Apple.