Skip to content

Commit

Permalink
fix(cognito): fix verify SSO call
Browse files Browse the repository at this point in the history
  • Loading branch information
samueljamesbliss committed Oct 17, 2023
1 parent ffe00a8 commit 9afaa9a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/javascript/src/post-confirmation-lambda/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const handler = async (event) => {
return event;
}

event = await handleUserMigration(event);
event = await handleUserMigration(event, token);

const { success, errorMessage } = await Jane.createUser({
pool_id: event.userPoolId,
Expand All @@ -51,7 +51,7 @@ export const handler = async (event) => {
instead we handle those migrations here, after signup.
If a user is signing up via sso, we check for a Jane SSO user
associated with this client and use that users data for the migration */
const handleUserMigration = async (event) => {
const handleUserMigration = async (event, token) => {
let userIdentities;
try {
userIdentities = JSON.parse(event.request.userAttributes.identities);
Expand All @@ -69,9 +69,9 @@ export const handler = async (event) => {

const { errorMessage, user } = await Jane.verifySSOUser({
email: event.request.userAttributes.email,
userAttributes: event.request.userAttributes,
appClientId: event.callerContext.clientId,
});
user_attributes: event.request.userAttributes,
app_client_id: event.callerContext.clientId,
}, token);
if (errorMessage === "User not found") {
// Jane user for this client was not found, continue normal sign up
return event;
Expand Down

0 comments on commit 9afaa9a

Please sign in to comment.