pify/auth
The client-credentials grant for apps made in the Dev Dashboard.
Such an app has no static token. It trades its client id and secret for
an access token that lasts about 24 hours. The library holds no state:
the consumer caches the token and asks for a new one before
expires_in_seconds runs out. A legacy custom app keeps its static
shpat_ token and never calls this module.
Types
pub type AccessToken {
AccessToken(
token: String,
scope: List(String),
expires_in_seconds: Int,
)
}
Constructors
-
AccessToken( token: String, scope: List(String), expires_in_seconds: Int, )
Values
pub fn client_credentials(
shop_domain shop_domain: String,
client_id client_id: String,
client_secret client_secret: String,
) -> effect.Effect(Result(AccessToken, error.ShopifyError), key)
pub fn client_credentials_request(
shop_domain shop_domain: String,
client_id client_id: String,
client_secret client_secret: String,
) -> request.ShopifyRequest
pub fn handle_response(
response: response.Response(BitArray),
) -> Result(AccessToken, error.ShopifyError)
Shopify answers a wrong id or secret with 400 or 401.