View Source AppStore.Token (App Store v0.2.0)
A module to geenrate the signed token for API usage.
Please also check AppStore.Token.Server
for a GenServer
to cache
Summary
Functions
Generate the token for API Requests
Types
Functions
@spec generate_token(String.t(), String.t(), key()) :: {:error, atom() | keyword()} | {:ok, binary(), %{optional(binary()) => any()}}
Generate the token for API Requests
Official documentation: Generating Tokens for API Requests
Options
issuer_id
: Your issuer ID from the Keys page in App Store Connectbundle_id
: Your app’s bundle IDkey
: a map with the Key ID and Private keyid
: Your private key ID from App Store Connectpem
: Your private API key generated from App Store Connect, please check Creating API Keys to Use With the App Store Server API
Example
iex> AppStore.Token.generate_token(
"57246542-96fe-1a63-e053-0824d011072a",
"com.example.testbundleid2021",
%{
id: "2X9R4HXF34",
pem: "-----BEGIN PRIVATE KEY----- ..."
}
)
"eyJhbGciOiJFUzI1NiIsImtpZCI6IjJYOVI0SFhGMzQiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiJhcHBzdG9yZWNvbm5lY3QtdjEiLCJiaWQiOiJjb20uZXhhbXBsZS50ZXN0YnVuZGxlaWQyMDIxIiwiZXhwIjoxNjI5NTA2MjQwLCJpYXQiOjE2Mjk1MDI3MDAsImlzcyI6IjU3MjQ2NTQyLTk2ZmUtMWE2My1lMDUzLTA4MjRkMDExMDcyYSIsIm5vbmNlIjoiMnFlaWc0a2wxOTQ0aHFhbmVzMDAwMGMxIn0.gYa_A7J6a6UAyBTAohf4gj28jT0k-OX1CW8cwsVGb4EewEm3owdsv6iWvzt7SutCndCBg5hPfNFWuZ0Au20HxA"