go-shopify icon indicating copy to clipboard operation
go-shopify copied to clipboard

Why does `StorefrontAccessTokenService` accept a `StorefrontAccessToken`?

Open Nikola-Milovic opened this issue 11 months ago • 1 comments

If I wanted to create a storefront access token, why do I have to pass in a StorefrontAccessToken?

type StorefrontAccessTokenService interface {
	List(context.Context, interface{}) ([]StorefrontAccessToken, error)
	Create(context.Context, StorefrontAccessToken) (*StorefrontAccessToken, error)
	Delete(context.Context, uint64) error
}

The api is

curl -d '{"storefront_access_token":{"title":"Test"}}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2024-01/storefront_access_tokens.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

Seems that only the title is required?

Nikola-Milovic avatar Mar 22 '24 10:03 Nikola-Milovic

You're right, that seems like a bug, thanks for reporting!

oliver006 avatar Apr 28 '24 15:04 oliver006

Just looked at this again and I think this is fine. See the docs here: https://shopify.dev/docs/api/admin-rest/2024-04/resources/storefrontaccesstoken#post-storefront-access-tokens Looks like only title is relevant but the whole storefrontaccesstoken object is passed. Let's leave this as is.

oliver006 avatar May 26 '24 04:05 oliver006