shopify_oauth v1.0.1 Shopify.OAuth
Link to this section Summary
Functions
Create an access token.
Send a request to Shopify.
Ensures an HTTP query string passes HMAC verification.
Verifies the Shopify HMAC signature.
Link to this section Types
Link to this type
response_t()
response_t() ::
{:ok, Shopify.OAuth.Response.t()}
| {:error, Shopify.OAuth.Response.t() | any()}
Link to this section Functions
Link to this function
create_access_token(params)
create_access_token(map()) :: Shopify.OAuth.Operation.t()
Create an access token.
Link to this function
request(operation, config)
request(Shopify.OAuth.Operation.t(), map()) :: response_t()
Send a request to Shopify.
Link to this function
verify_hmac(query, shared_secret)
Ensures an HTTP query string passes HMAC verification.
See verify_hmac/3 for more details.
Example
query = "code=0907a61c0c8d55e99db179b68161bc00&hmac=700e2dadb827fcc8609e9d5ce208b2e9cdaab9df07390d2cbca10d7c328fc4bf&shop=some-shop.myshopify.com&state=0.6784241404160823×tamp=1337178173"
shared_secret = "hush"
{:ok, hmac} = Shopify.OAuth.verify_hmac(query, shared_secret)
Link to this function
verify_hmac(hmac, message, shared_secret)
Verifies the Shopify HMAC signature.
This function will compute an SHA256 HMAC digest based on the provided
message and shared_secret. The digest is then compared to the hmac
signature. If they match, verification has passed. Otherwise verification
has failed.
Example
hmac = "700e2dadb827fcc8609e9d5ce208b2e9cdaab9df07390d2cbca10d7c328fc4bf"
message = "code=0907a61c0c8d55e99db179b68161bc00&shop=some-shop.myshopify.com×tamp=1337178173"
shared_secret = "hush"
{:ok, hmac} = Shopify.HMAC.verify(hmac, message, shared_secret)