A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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!