From 210c33df91cc2219dbe8350dddaf9ffe76cbcf5a Mon Sep 17 00:00:00 2001 From: John Hossler Date: Fri, 24 Nov 2023 12:45:13 -0800 Subject: [PATCH] fix: use uri to make token storage key unique (#239) * fix: move token generation to agent (#1) * fix: add uri to token storage key to prevent clashes (#2) * Catch up with upstream (#3) * fix: allow httpoison 2.0 (#236) * fix: allow httpoison 2.0 * ci: fix workflows * ci: revert to ubuntu-latest * ci: use setup-beam@v1 * chore: update CHANGELOG * docs: update README links * fix: move token generation into Pigeon.APNS.Token (#227) This means the token is only generated once and used across all workers * chore: update CHANGELOG --------- Co-authored-by: Henry Popp Co-authored-by: Henry Popp Co-authored-by: Andrew Timberlake * chore: run mix format on our changes (#4) * fix: allow httpoison 2.0 (#236) * fix: allow httpoison 2.0 * ci: fix workflows * ci: revert to ubuntu-latest * ci: use setup-beam@v1 * chore: update CHANGELOG * docs: update README links * fix: move token generation into Pigeon.APNS.Token (#227) This means the token is only generated once and used across all workers * chore: update CHANGELOG --------- Co-authored-by: Henry Popp Co-authored-by: Henry Popp Co-authored-by: Andrew Timberlake * chore: undo random formatting changes that aren't necessary --------- Co-authored-by: Drew Ballance Co-authored-by: Henry Popp Co-authored-by: Henry Popp Co-authored-by: Andrew Timberlake --- lib/pigeon/apns/token.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pigeon/apns/token.ex b/lib/pigeon/apns/token.ex index b796e178..96280ced 100644 --- a/lib/pigeon/apns/token.ex +++ b/lib/pigeon/apns/token.ex @@ -26,7 +26,8 @@ defmodule Pigeon.APNS.Token do @spec get(JWTConfig.t()) :: t def get(%JWTConfig{} = config) do - token_storage_key = config.key_identifier <> ":" <> config.team_id + token_storage_key = + config.key_identifier <> ":" <> config.team_id <> ":" <> config.uri Agent.get_and_update(__MODULE__, fn map -> {timestamp, saved_token} = Map.get(map, token_storage_key, {0, nil})