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

Allow sending and retrieval of additionalContext within authentication flow #937

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/marko-web-identity-x/browser/authenticate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ export default {
isProfileComplete: this.isProfileComplete,
requiresCustomFieldAnswers: this.requiresCustomFieldAnswers,
actionSource: data.loginSource,
...(
data.additionalContext
&& data.additionalContext.newsletterSignupType
&& { newsletterSignupType: data.additionalContext.newsletterSignupType }
),
additionalEventData: {
...(this.additionalEventData || {}),
...(data.additionalEventData || {}),
Expand Down
3 changes: 3 additions & 0 deletions packages/marko-web-identity-x/routes/authenticate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const gql = require('graphql-tag');
const { getAsObject } = require('@parameter1/base-cms-object-path');
const { asyncRoute } = require('@parameter1/base-cms-utils');
const tokenCookie = require('../utils/token-cookie');
const contextCookie = require('../utils/context-cookie');
Expand All @@ -16,6 +17,7 @@ const loginAppUser = gql`
...ActiveUserFragment
}
loginSource
additionalContext
}
}

Expand Down Expand Up @@ -51,6 +53,7 @@ module.exports = asyncRoute(async (req, res) => {
applicationId: identityX.config.getAppId(),
user,
loginSource,
additionalContext: getAsObject(data, 'loginAppUser.additionalContext'),
additionalEventData,
entity,
});
Expand Down
1 change: 1 addition & 0 deletions packages/marko-web-identity-x/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ class IdentityX {
appContextId: this.config.get('appContextId'),
source,
redirectTo,
additionalContext: additionalEventData,
},
},
});
Expand Down
Loading