Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #23 from osmszk/additional_data_for_koa_auth
Browse files Browse the repository at this point in the history
[Feature]Add missing associated user data to the session
  • Loading branch information
Tim Anema authored Oct 22, 2020
2 parents 4ae1efc + 3654247 commit 4e79d5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added

- Provide user data via Koa Session

## [3.1.72] - 2020-10-16

Expand Down
8 changes: 7 additions & 1 deletion 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

0 comments on commit 4e79d5e

Please sign in to comment.