How to get shop name and accessToken during oAuthProcess

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?

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);

@SBD will this access token be same for life time?

Yep, unless your app is uninstalled or you revoke the access token.

Thank you!