Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Add missing data to session #1542

Closed
wants to merge 10 commits into from
8 changes: 7 additions & 1 deletion packages/koa-shopify-auth/src/auth/create-oauth-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,17 @@ export default function createOAuthCallback(config: AuthConfig) {
}

const accessTokenData = await accessTokenResponse.json();
const {access_token: accessToken} = accessTokenData;
const {
access_token: accessToken,
associated_user_scope: associatedUserScope,
associated_user: associatedUser,
} = accessTokenData;

if (ctx.session) {
ctx.session.shop = shop;
ctx.session.accessToken = accessToken;
ctx.session.associatedUserScope = associatedUserScope;
ctx.session.associatedUser = associatedUser;
}

ctx.state.shopify = {
Expand Down