Questions and discussions about using the Shopify CLI and Shopify-built libraries.
Can anyone explain how to get the email address, first name, and last name of the authenticated admin user from a Shopify app created in Node using the v3 CLI?
I previously used session.onlineAccessInfo.associated_user.email
, session.onlineAccessInfo.associated_user.first_name
, and session.onlineAccessInfo.associated_user.last_name
with the v2 CLI code, but after enabling online tokens in the v3 CLI code, id
is the only property I'm seeing on associated_user
.
I see there's the StaffMember GraphQL endpoint which I could query, but that doesn't seem like a viable option due to the following notice:
Requires read_users access scope. Also: The app must be a finance embedded app or installed on a Shopify Plus or Advanced store. Contact Shopify Support to enable this scope for your app.
I don't need this data for anyone other than the authenticated admin user. How else can I retrieve this information? Is there a way to get this data populated on session.onlineAccessInfo.associated_user
again as it was in the past?
It turns out this data was being passed, but the default session storage options discard everything but the user id. The solution is to use either the out-of-the-box MemorySessionStorage option or implement your own custom storage.
It does look to be the case: https://github.com/Shopify/shopify-api-js/blob/d61f811146dd9bad39969e33e9d2690251ae8009/lib/session/...
Any particular reason for this? I am wanting to automatically register a user when they install the app and this is the only place that I can see that provides the name and email of the user installing the application.
Are there any other way to get the user details?