Skip to content

Commit

Permalink
fix: api call missing auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-sr88 committed Nov 20, 2023
1 parent f7ee71f commit 7f63dae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions examples/javascript/src/lib/jane-service.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const createUser = async (data, token) => {
// }
// }

const ensureExternalUserExists = async (data) => {
const response = await apiService.post(`${COGNITO_API}/ensure_external_user_exists`, data)
const ensureExternalUserExists = async (data, token) => {
const response = await apiService.post(`${COGNITO_API}/ensure_external_user_exists`, data, token)

return {
success: response.statusCode === 200,
Expand Down Expand Up @@ -134,16 +134,16 @@ const verifySSOUser = async (data, token) => {
const parsedData = {
...data,
user_attributes: {
...data.user_attributes,
...data.user_attributes,
identities: JSON.parse(data.user_attributes.identities)
}
}
}
}
const response = await apiService.post(
`${COGNITO_API}/verify_sso_user`,
parsedData,
token
)

const result = {
errorMessage: "",
user: response.body?.user,
Expand Down
2 changes: 1 addition & 1 deletion examples/javascript/src/pre-signup-lambda/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const handler = async (event) => {
external_id: event.userName,
email: userData.email,
user_attributes: userData.user_attributes,
})
}, token)

if (!success) {
throw new Error(`ensureExternalUserExists was not successful: ${errorMessage}`)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"make:dist": "mkdir -p dist/migration-lambda && mkdir -p dist/post-confirmation-lambda && mkdir -p dist/pre-signup-lambda",
"compile:migration-lambda": "npm run make:dist && esbuild examples/javascript/src/migration-lambda/index.mjs --platform=node --target=es2020 --bundle --minify --outfile=dist/migration-lambda/index.js",
"compile:post-confirmation-lambda": "npm run make:dist && esbuild examples/javascript/src/post-confirmation-lambda/index.mjs --platform=node --target=es2020 --bundle --minify --outfile=dist/post-confirmation-lambda/index.js",
"compile:pre-signup-lambda": "npm run make:dist && esbuild examples/javascript/src/pre-signup-lambda/index.mjs --platform=node --target=es2020 --bundle --minify --outfile=dist/pre-signup-lambda/index.js",
"compile:pre-signup-lambda": "npm run make:dist && esbuild examples/javascript/src/pre-signup-lambda/index.mjs --platform=node --target=es2020 --bundle --outfile=dist/pre-signup-lambda/index.js",
"zip:migration-lambda": "cd dist/migration-lambda && zip -r ../migrateUserHandler.zip .",
"zip:post-confirmation-lambda": "cd dist/post-confirmation-lambda && zip -r ../postConfirmationHandler.zip .",
"zip:pre-signup-lambda": "cd dist/pre-signup-lambda && zip -r ../preSignUpHandler.zip .",
Expand Down

0 comments on commit 7f63dae

Please sign in to comment.