Skip to content

Commit 546d112

Browse files
committed
Get rid of hard coded string for aud in jwt
1 parent 99a7d5e commit 546d112

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/models/apple/api.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# frozen_string_literal: true
22

3+
# NOTE: This code does not connect directly to Apple, a bridge lambda is used in between to handle communication and API calls.
4+
# This is not an official Apple API client, and to use Apple API you will need to have your own agreement with Apple to access their APIs.
5+
36
module Apple
47
class Api
58
ERROR_RETRIES = 3
@@ -30,6 +33,10 @@ def self.api_base
3033
ENV["APPLE_PODCASTS_CONNECT_API_URL"]
3134
end
3235

36+
def self.api_aud_name
37+
ENV["APPLE_PODCASTS_CONNECT_AUD_NAME"]
38+
end
39+
3340
def self.from_key(apple_key)
3441
new(provider_id: apple_key.provider_id,
3542
key_id: apple_key.key_id,
@@ -72,7 +79,7 @@ def jwt_payload
7279

7380
{iss: provider_id,
7481
exp: now.to_i + (60 * 15),
75-
aud: "podcastsconnect-v1"}
82+
aud: self.class.api_aud_name}
7683
end
7784

7885
def jwt_headers

0 commit comments

Comments
 (0)