UNPKG

@aws-amplify/auth

Version:

Auth category of aws-amplify

1 lines • 2.58 kB
{"version":3,"file":"signIn.mjs","sources":["../../../../../src/providers/cognito/apis/signIn.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { resolveCtxArgs } from '@aws-amplify/core/internals/utils';\nimport { assertUserNotAuthenticated } from '../utils/signInHelpers';\nimport { signInWithCustomAuth } from './signInWithCustomAuth';\nimport { signInWithCustomSRPAuth } from './signInWithCustomSRPAuth';\nimport { signInWithSRP } from './signInWithSRP';\nimport { signInWithUserPassword } from './signInWithUserPassword';\nimport { signInWithUserAuth } from './signInWithUserAuth';\nimport { resetAutoSignIn } from './autoSignIn';\nexport async function signIn(...args) {\n const [ctx, input] = resolveCtxArgs(args);\n // Here we want to reset the store but not reassign the callback.\n // The callback is reset when the underlying promise resolves or rejects.\n // With the advent of session based sign in, this guarantees that the signIn API initiates a new auth flow,\n // regardless of whether it is called for a user currently engaged in an active auto sign in session.\n resetAutoSignIn(false);\n const authFlowType = input.options?.authFlowType;\n await assertUserNotAuthenticated(ctx);\n switch (authFlowType) {\n case 'USER_SRP_AUTH':\n return signInWithSRP(ctx, input);\n case 'USER_PASSWORD_AUTH':\n return signInWithUserPassword(ctx, input);\n case 'CUSTOM_WITHOUT_SRP':\n return signInWithCustomAuth(ctx, input);\n case 'CUSTOM_WITH_SRP':\n return signInWithCustomSRPAuth(ctx, input);\n case 'USER_AUTH':\n return signInWithUserAuth(ctx, input);\n default:\n return signInWithSRP(ctx, input);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AASO,eAAe,MAAM,CAAC,GAAG,IAAI,EAAE;AACtC,IAAI,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC;AAC7C;AACA;AACA;AACA;AACA,IAAI,eAAe,CAAC,KAAK,CAAC;AAC1B,IAAI,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,EAAE,YAAY;AACpD,IAAI,MAAM,0BAA0B,CAAC,GAAG,CAAC;AACzC,IAAI,QAAQ,YAAY;AACxB,QAAQ,KAAK,eAAe;AAC5B,YAAY,OAAO,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC;AAC5C,QAAQ,KAAK,oBAAoB;AACjC,YAAY,OAAO,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC;AACrD,QAAQ,KAAK,oBAAoB;AACjC,YAAY,OAAO,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC;AACnD,QAAQ,KAAK,iBAAiB;AAC9B,YAAY,OAAO,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC;AACtD,QAAQ,KAAK,WAAW;AACxB,YAAY,OAAO,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC;AACjD,QAAQ;AACR,YAAY,OAAO,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC;AAC5C;AACA;;;;"}