Ways of obtaining token

Hi

Hi, support staff.

Really hope ya’ll could help :folded_hands:

I’m reaching out on behalf of our back-s.:

We are currently utilizing the /admin/api/2024-01/products/632910392/metafields.json endpoint for creating product metafields in our application. As part of the header parameters, we’re including X-Shopify-Access-Token: access_token.

To streamline our process, we are curious about the possible endpoints or methods available for obtaining this access token.

Additionally, we are interested in understanding if there is a way to acquire the access_token in the background. This is crucial for our workflow as we aim to post metafields across various shops and products.

Hey @GeorgeStrongg

Here are the oAuth docs outlining the usual flow. Alternatively, you can create multiple private apps.

1 Like

Hi George - the steps you’ll want to take are:

  • After the shop owner/administrator grants permission, they will be redirected to a URL you specify in your app settings. The URL will include a temporary code.

  • Your app must then exchange this temporary code for a permanent access token by making a POST request to this endpoint:https://{shop}.myshopify.com/admin/oauth/access_token

  • In the POST request, include the following parameters:

    • client_id: Your app’s API key.
    • client_secret: Your app’s API secret key.
    • code: The temporary code received.

Shopify will then respond with an access token that you can use for making authenticated API requests on behalf of that specific shop.

1 Like

Thanks, pal. Appreciate your help!

Liam, u r amazing. Thanks!