Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi. I'm trying to create a delegate access token as documented here, but I'm getting 400 Bad Request errors.
Here's how I execute the call inside my auth/callback route (both shop and accessToken values are successfully retrieved):
const shop = req.query.shop
const {accessToken} = await Shopify.Utils.loadOfflineSession(shop)
fetch(`https://${shop}/admin/access_tokens/delegate.json`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Shopify-Access-Token': accessToken
},
body: JSON.stringify({
delegate_access_scope: 'read_products'
})
})
.then(result => console.log(result))
Side note: aside from the linked page, I can't find this documented anywhere in the REST Admin API reference. Am I looking in the wrong place?
In my code I am also facing the similar kind of problems while solving an error if I solve one then other error occurs so pleaseguide me why its not working for me?
It seems that delegate_access_scope expects a list of access_scopes, so you would need to change its value to ['read_products']
const shop = req.query.shop
const {accessToken} = await Shopify.Utils.loadOfflineSession(shop)
fetch(`https://${shop}/admin/access_tokens/delegate.json`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Shopify-Access-Token': accessToken
},
body: JSON.stringify({
delegate_access_scope: ['read_products']
})
})
.then(result => console.log(result))
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024