A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I am trying to get access token and shopName from latest shopify app embedded code template.
Here is the following code
How would I get it when someone installs my app?
Solved! Go to the solution
This is an accepted solution.
Hey @Faateh
Access token is part of the session:
const { accessToken } = res.locals.shopify.session;
And the shop name can be obtained like this:
const { data } = await shopify.api.rest.Shop.all({
session: res.locals.shopify.session,
})
console.log(data[0].name);
Scott | Developer Advocate @ Shopify
This is an accepted solution.
Hey @Faateh
Access token is part of the session:
const { accessToken } = res.locals.shopify.session;
And the shop name can be obtained like this:
const { data } = await shopify.api.rest.Shop.all({
session: res.locals.shopify.session,
})
console.log(data[0].name);
Scott | Developer Advocate @ Shopify
Yep, unless your app is uninstalled or you revoke the access token.
Scott | Developer Advocate @ Shopify
Thank you!