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))
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024