@aws-amplify/auth 6.12.4 → 6.12.5-local-stack.00864ae.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/cjs/client/apis/associateWebAuthnCredential.js +1 -2
  2. package/dist/cjs/client/apis/associateWebAuthnCredential.js.map +1 -1
  3. package/dist/cjs/client/apis/deleteWebAuthnCredential.js +1 -2
  4. package/dist/cjs/client/apis/deleteWebAuthnCredential.js.map +1 -1
  5. package/dist/cjs/client/apis/listWebAuthnCredentials.js +1 -2
  6. package/dist/cjs/client/apis/listWebAuthnCredentials.js.map +1 -1
  7. package/dist/cjs/client/flows/shared/handlePasswordSRP.js +1 -2
  8. package/dist/cjs/client/flows/shared/handlePasswordSRP.js.map +1 -1
  9. package/dist/cjs/client/flows/userAuth/handleSelectChallenge.js +1 -2
  10. package/dist/cjs/client/flows/userAuth/handleSelectChallenge.js.map +1 -1
  11. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPassword.js +1 -2
  12. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPassword.js.map +1 -1
  13. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.js +1 -2
  14. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.js.map +1 -1
  15. package/dist/cjs/client/flows/userAuth/handleUserAuthFlow.js +1 -2
  16. package/dist/cjs/client/flows/userAuth/handleUserAuthFlow.js.map +1 -1
  17. package/dist/cjs/client/flows/userAuth/handleWebAuthnSignInResult.js +1 -2
  18. package/dist/cjs/client/flows/userAuth/handleWebAuthnSignInResult.js.map +1 -1
  19. package/dist/cjs/client/utils/passkey/errors.js +1 -1
  20. package/dist/cjs/client/utils/passkey/errors.js.map +1 -1
  21. package/dist/cjs/client/utils/passkey/types/index.js +3 -3
  22. package/dist/cjs/client/utils/passkey/types/index.js.map +1 -1
  23. package/dist/cjs/client/utils/passkey/types/shared.js +1 -2
  24. package/dist/cjs/client/utils/passkey/types/shared.js.map +1 -1
  25. package/dist/cjs/client/utils/store/signInStore.js +2 -2
  26. package/dist/cjs/client/utils/store/signInStore.js.map +1 -1
  27. package/dist/cjs/common/AuthErrorStrings.js +5 -2
  28. package/dist/cjs/common/AuthErrorStrings.js.map +1 -1
  29. package/dist/cjs/errors/types/validation.js +2 -1
  30. package/dist/cjs/errors/types/validation.js.map +1 -1
  31. package/dist/cjs/errors/utils/assertServiceError.js +1 -2
  32. package/dist/cjs/errors/utils/assertServiceError.js.map +1 -1
  33. package/dist/cjs/errors/utils/assertValidationError.js +1 -2
  34. package/dist/cjs/errors/utils/assertValidationError.js.map +1 -1
  35. package/dist/cjs/foundation/apis/deleteWebAuthnCredential.js +1 -2
  36. package/dist/cjs/foundation/apis/deleteWebAuthnCredential.js.map +1 -1
  37. package/dist/cjs/foundation/apis/listWebAuthnCredentials.js +1 -2
  38. package/dist/cjs/foundation/apis/listWebAuthnCredentials.js.map +1 -1
  39. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.js +8 -4
  40. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.js.map +1 -1
  41. package/dist/cjs/foundation/parsers/regionParsers.js +2 -3
  42. package/dist/cjs/foundation/parsers/regionParsers.js.map +1 -1
  43. package/dist/cjs/providers/cognito/apis/autoSignIn.js +3 -3
  44. package/dist/cjs/providers/cognito/apis/autoSignIn.js.map +1 -1
  45. package/dist/cjs/providers/cognito/apis/confirmResetPassword.js +1 -2
  46. package/dist/cjs/providers/cognito/apis/confirmResetPassword.js.map +1 -1
  47. package/dist/cjs/providers/cognito/apis/confirmSignIn.js +1 -2
  48. package/dist/cjs/providers/cognito/apis/confirmSignIn.js.map +1 -1
  49. package/dist/cjs/providers/cognito/apis/confirmSignUp.js +1 -2
  50. package/dist/cjs/providers/cognito/apis/confirmSignUp.js.map +1 -1
  51. package/dist/cjs/providers/cognito/apis/confirmUserAttribute.js +1 -2
  52. package/dist/cjs/providers/cognito/apis/confirmUserAttribute.js.map +1 -1
  53. package/dist/cjs/providers/cognito/apis/deleteUser.js +1 -2
  54. package/dist/cjs/providers/cognito/apis/deleteUser.js.map +1 -1
  55. package/dist/cjs/providers/cognito/apis/deleteUserAttributes.js +1 -2
  56. package/dist/cjs/providers/cognito/apis/deleteUserAttributes.js.map +1 -1
  57. package/dist/cjs/providers/cognito/apis/fetchDevices.js +1 -2
  58. package/dist/cjs/providers/cognito/apis/fetchDevices.js.map +1 -1
  59. package/dist/cjs/providers/cognito/apis/fetchMFAPreference.js +1 -2
  60. package/dist/cjs/providers/cognito/apis/fetchMFAPreference.js.map +1 -1
  61. package/dist/cjs/providers/cognito/apis/forgetDevice.js +1 -2
  62. package/dist/cjs/providers/cognito/apis/forgetDevice.js.map +1 -1
  63. package/dist/cjs/providers/cognito/apis/rememberDevice.js +1 -2
  64. package/dist/cjs/providers/cognito/apis/rememberDevice.js.map +1 -1
  65. package/dist/cjs/providers/cognito/apis/resendSignUpCode.js +1 -2
  66. package/dist/cjs/providers/cognito/apis/resendSignUpCode.js.map +1 -1
  67. package/dist/cjs/providers/cognito/apis/resetPassword.js +1 -2
  68. package/dist/cjs/providers/cognito/apis/resetPassword.js.map +1 -1
  69. package/dist/cjs/providers/cognito/apis/setUpTOTP.js +1 -2
  70. package/dist/cjs/providers/cognito/apis/setUpTOTP.js.map +1 -1
  71. package/dist/cjs/providers/cognito/apis/signIn.js +1 -2
  72. package/dist/cjs/providers/cognito/apis/signIn.js.map +1 -1
  73. package/dist/cjs/providers/cognito/apis/signInWithCustomAuth.js +1 -2
  74. package/dist/cjs/providers/cognito/apis/signInWithCustomAuth.js.map +1 -1
  75. package/dist/cjs/providers/cognito/apis/signInWithCustomSRPAuth.js +1 -2
  76. package/dist/cjs/providers/cognito/apis/signInWithCustomSRPAuth.js.map +1 -1
  77. package/dist/cjs/providers/cognito/apis/signInWithRedirect.js +1 -2
  78. package/dist/cjs/providers/cognito/apis/signInWithRedirect.js.map +1 -1
  79. package/dist/cjs/providers/cognito/apis/signInWithSRP.js +1 -2
  80. package/dist/cjs/providers/cognito/apis/signInWithSRP.js.map +1 -1
  81. package/dist/cjs/providers/cognito/apis/signInWithUserAuth.js +1 -2
  82. package/dist/cjs/providers/cognito/apis/signInWithUserAuth.js.map +1 -1
  83. package/dist/cjs/providers/cognito/apis/signInWithUserPassword.js +1 -2
  84. package/dist/cjs/providers/cognito/apis/signInWithUserPassword.js.map +1 -1
  85. package/dist/cjs/providers/cognito/apis/signOut.js +1 -2
  86. package/dist/cjs/providers/cognito/apis/signOut.js.map +1 -1
  87. package/dist/cjs/providers/cognito/apis/signUp.js +1 -2
  88. package/dist/cjs/providers/cognito/apis/signUp.js.map +1 -1
  89. package/dist/cjs/providers/cognito/apis/updateMFAPreference.js +2 -3
  90. package/dist/cjs/providers/cognito/apis/updateMFAPreference.js.map +1 -1
  91. package/dist/cjs/providers/cognito/apis/updatePassword.js +1 -2
  92. package/dist/cjs/providers/cognito/apis/updatePassword.js.map +1 -1
  93. package/dist/cjs/providers/cognito/apis/verifyTOTPSetup.js +1 -2
  94. package/dist/cjs/providers/cognito/apis/verifyTOTPSetup.js.map +1 -1
  95. package/dist/cjs/providers/cognito/credentialsProvider/IdentityIdProvider.js +8 -3
  96. package/dist/cjs/providers/cognito/credentialsProvider/IdentityIdProvider.js.map +1 -1
  97. package/dist/cjs/providers/cognito/credentialsProvider/credentialsProvider.js +13 -2
  98. package/dist/cjs/providers/cognito/credentialsProvider/credentialsProvider.js.map +1 -1
  99. package/dist/cjs/providers/cognito/credentialsProvider/utils.js +1 -2
  100. package/dist/cjs/providers/cognito/credentialsProvider/utils.js.map +1 -1
  101. package/dist/cjs/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.js +16 -0
  102. package/dist/cjs/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.js.map +1 -0
  103. package/dist/cjs/providers/cognito/factories/index.js +3 -1
  104. package/dist/cjs/providers/cognito/factories/index.js.map +1 -1
  105. package/dist/cjs/providers/cognito/tokenProvider/TokenStore.js +2 -2
  106. package/dist/cjs/providers/cognito/tokenProvider/TokenStore.js.map +1 -1
  107. package/dist/cjs/providers/cognito/tokenProvider/cacheTokens.js +1 -2
  108. package/dist/cjs/providers/cognito/tokenProvider/cacheTokens.js.map +1 -1
  109. package/dist/cjs/providers/cognito/tokenProvider/errorHelpers.js +1 -1
  110. package/dist/cjs/providers/cognito/tokenProvider/errorHelpers.js.map +1 -1
  111. package/dist/cjs/providers/cognito/types/errors.js +48 -24
  112. package/dist/cjs/providers/cognito/types/errors.js.map +1 -1
  113. package/dist/cjs/providers/cognito/utils/apiHelpers.js +2 -3
  114. package/dist/cjs/providers/cognito/utils/apiHelpers.js.map +1 -1
  115. package/dist/cjs/providers/cognito/utils/getNewDeviceMetadata.js +1 -2
  116. package/dist/cjs/providers/cognito/utils/getNewDeviceMetadata.js.map +1 -1
  117. package/dist/cjs/providers/cognito/utils/handleDeviceSRPAuth.js +1 -2
  118. package/dist/cjs/providers/cognito/utils/handleDeviceSRPAuth.js.map +1 -1
  119. package/dist/cjs/providers/cognito/utils/handlePasswordVerifierChallenge.js +1 -2
  120. package/dist/cjs/providers/cognito/utils/handlePasswordVerifierChallenge.js.map +1 -1
  121. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.js +2 -5
  122. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.js.map +1 -1
  123. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.native.js +1 -2
  124. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.native.js.map +1 -1
  125. package/dist/cjs/providers/cognito/utils/retryOnResourceNotFoundException.js +1 -2
  126. package/dist/cjs/providers/cognito/utils/retryOnResourceNotFoundException.js.map +1 -1
  127. package/dist/cjs/providers/cognito/utils/setActiveSignInUsername.js +1 -2
  128. package/dist/cjs/providers/cognito/utils/setActiveSignInUsername.js.map +1 -1
  129. package/dist/cjs/providers/cognito/utils/signInHelpers.js +22 -23
  130. package/dist/cjs/providers/cognito/utils/signInHelpers.js.map +1 -1
  131. package/dist/cjs/providers/cognito/utils/signUpHelpers.js +3 -3
  132. package/dist/cjs/providers/cognito/utils/signUpHelpers.js.map +1 -1
  133. package/dist/cjs/providers/cognito/utils/types.js +6 -6
  134. package/dist/cjs/providers/cognito/utils/types.js.map +1 -1
  135. package/dist/cjs/providers/cognito/utils/userContextData.js +1 -2
  136. package/dist/cjs/providers/cognito/utils/userContextData.js.map +1 -1
  137. package/dist/cjs/providers/cognito/utils/userContextData.native.js +1 -2
  138. package/dist/cjs/providers/cognito/utils/userContextData.native.js.map +1 -1
  139. package/dist/cjs/types/Auth.js +2 -1
  140. package/dist/cjs/types/Auth.js.map +1 -1
  141. package/dist/esm/client/flows/shared/handlePasswordSRP.mjs +1 -0
  142. package/dist/esm/client/flows/shared/handlePasswordSRP.mjs.map +1 -1
  143. package/dist/esm/client/flows/userAuth/handleSelectChallenge.mjs +1 -0
  144. package/dist/esm/client/flows/userAuth/handleSelectChallenge.mjs.map +1 -1
  145. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.mjs +1 -0
  146. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.mjs.map +1 -1
  147. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.mjs +1 -0
  148. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.mjs.map +1 -1
  149. package/dist/esm/client/flows/userAuth/handleUserAuthFlow.mjs +1 -0
  150. package/dist/esm/client/flows/userAuth/handleUserAuthFlow.mjs.map +1 -1
  151. package/dist/esm/foundation/apis/deleteWebAuthnCredential.mjs +1 -0
  152. package/dist/esm/foundation/apis/deleteWebAuthnCredential.mjs.map +1 -1
  153. package/dist/esm/foundation/apis/listWebAuthnCredentials.mjs +1 -0
  154. package/dist/esm/foundation/apis/listWebAuthnCredentials.mjs.map +1 -1
  155. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/constants.d.ts +1 -1
  156. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createAssociateSoftwareTokenClient.d.ts +2 -2
  157. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createChangePasswordClient.d.ts +2 -2
  158. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.d.ts +2 -2
  159. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmDeviceClient.d.ts +2 -2
  160. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmForgotPasswordClient.d.ts +2 -2
  161. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmSignUpClient.d.ts +2 -2
  162. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserAttributesClient.d.ts +2 -2
  163. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserClient.d.ts +2 -2
  164. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.d.ts +2 -2
  165. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createForgetDeviceClient.d.ts +2 -2
  166. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createForgotPasswordClient.d.ts +2 -2
  167. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserAttributeVerificationCodeClient.d.ts +2 -2
  168. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserClient.d.ts +2 -2
  169. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGlobalSignOutClient.d.ts +2 -2
  170. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createInitiateAuthClient.d.ts +2 -2
  171. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListDevicesClient.d.ts +2 -2
  172. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.d.ts +2 -2
  173. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createResendConfirmationCodeClient.d.ts +2 -2
  174. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.d.ts +2 -2
  175. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createRevokeTokenClient.d.ts +2 -2
  176. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSetUserMFAPreferenceClient.d.ts +2 -2
  177. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.d.ts +3 -3
  178. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.d.ts +2 -2
  179. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateDeviceStatusClient.d.ts +2 -2
  180. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateUserAttributesClient.d.ts +2 -2
  181. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifySoftwareTokenClient.d.ts +2 -2
  182. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifyUserAttributeClient.d.ts +2 -2
  183. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createEmptyResponseDeserializer.d.ts +1 -1
  184. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createUserPoolDeserializer.d.ts +1 -1
  185. package/dist/esm/providers/cognito/apis/internal/fetchUserAttributes.mjs +1 -0
  186. package/dist/esm/providers/cognito/apis/internal/fetchUserAttributes.mjs.map +1 -1
  187. package/dist/esm/providers/cognito/credentialsProvider/IdentityIdProvider.mjs +9 -1
  188. package/dist/esm/providers/cognito/credentialsProvider/IdentityIdProvider.mjs.map +1 -1
  189. package/dist/esm/providers/cognito/credentialsProvider/credentialsProvider.mjs +13 -1
  190. package/dist/esm/providers/cognito/credentialsProvider/credentialsProvider.mjs.map +1 -1
  191. package/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.d.ts +6 -0
  192. package/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.mjs +14 -0
  193. package/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.mjs.map +1 -0
  194. package/dist/esm/providers/cognito/factories/index.d.ts +1 -0
  195. package/dist/esm/providers/cognito/factories/index.mjs +1 -0
  196. package/dist/esm/providers/cognito/factories/index.mjs.map +1 -1
  197. package/dist/esm/providers/cognito/utils/getNewDeviceMetadata.mjs +1 -0
  198. package/dist/esm/providers/cognito/utils/getNewDeviceMetadata.mjs.map +1 -1
  199. package/dist/esm/providers/cognito/utils/handleDeviceSRPAuth.mjs +1 -0
  200. package/dist/esm/providers/cognito/utils/handleDeviceSRPAuth.mjs.map +1 -1
  201. package/dist/esm/providers/cognito/utils/handlePasswordVerifierChallenge.mjs +1 -0
  202. package/dist/esm/providers/cognito/utils/handlePasswordVerifierChallenge.mjs.map +1 -1
  203. package/dist/esm/providers/cognito/utils/oauth/attemptCompleteOAuthFlow.d.ts +1 -1
  204. package/dist/esm/providers/cognito/utils/oauth/completeOAuthFlow.d.ts +1 -1
  205. package/dist/esm/providers/cognito/utils/oauth/generateCodeVerifier.d.ts +1 -1
  206. package/dist/esm/providers/cognito/utils/oauth/getRedirectUrl.mjs +1 -3
  207. package/dist/esm/providers/cognito/utils/oauth/getRedirectUrl.mjs.map +1 -1
  208. package/dist/esm/providers/cognito/utils/refreshAuthTokens.d.ts +1 -1
  209. package/dist/esm/providers/cognito/utils/refreshAuthTokens.mjs +1 -0
  210. package/dist/esm/providers/cognito/utils/refreshAuthTokens.mjs.map +1 -1
  211. package/dist/esm/providers/cognito/utils/signInHelpers.d.ts +1 -1
  212. package/package.json +105 -106
  213. package/src/providers/cognito/credentialsProvider/IdentityIdProvider.ts +8 -1
  214. package/src/providers/cognito/credentialsProvider/credentialsProvider.ts +14 -1
  215. package/src/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.ts +15 -0
  216. package/src/providers/cognito/factories/index.ts +1 -0
  217. package/src/providers/cognito/utils/oauth/getRedirectUrl.ts +1 -2
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.signInWithRedirect = void 0;
6
+ exports.signInWithRedirect = signInWithRedirect;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  require("../utils/oauth/enableOAuthListener");
@@ -47,7 +47,6 @@ async function signInWithRedirect(input) {
47
47
  },
48
48
  });
49
49
  }
50
- exports.signInWithRedirect = signInWithRedirect;
51
50
  const oauthSignIn = async ({ oauthConfig, provider, clientId, customState, preferPrivateSession, options, }) => {
52
51
  const { domain, redirectSignIn, responseType, scopes } = oauthConfig;
53
52
  const { loginHint, lang, nonce } = options ?? {};
@@ -1 +1 @@
1
- {"version":3,"file":"signInWithRedirect.js","sources":["../../../../../src/providers/cognito/apis/signInWithRedirect.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signInWithRedirect = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nrequire(\"../utils/oauth/enableOAuthListener\");\nconst models_1 = require(\"../types/models\");\nconst utils_2 = require(\"../../../utils\");\nconst signInHelpers_1 = require(\"../utils/signInHelpers\");\nconst oauth_1 = require(\"../utils/oauth\");\nconst createOAuthError_1 = require(\"../utils/oauth/createOAuthError\");\nconst cancelOAuthFlow_1 = require(\"../utils/oauth/cancelOAuthFlow\");\n/**\n * Signs in a user with OAuth. Redirects the application to an Identity Provider.\n *\n * @param input - The SignInWithRedirectInput object, if empty it will redirect to Cognito HostedUI\n *\n * @throws AuthTokenConfigException - Thrown when the user pool config is invalid.\n * @throws OAuthNotConfigureException - Thrown when the oauth config is invalid.\n */\nasync function signInWithRedirect(input) {\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n (0, utils_1.assertOAuthConfig)(authConfig);\n oauth_1.oAuthStore.setAuthConfig(authConfig);\n await (0, signInHelpers_1.assertUserNotAuthenticated)();\n let provider = 'COGNITO'; // Default\n if (typeof input?.provider === 'string') {\n provider = models_1.cognitoHostedUIIdentityProviderMap[input.provider];\n }\n else if (input?.provider?.custom) {\n provider = input.provider.custom;\n }\n return oauthSignIn({\n oauthConfig: authConfig.loginWith.oauth,\n clientId: authConfig.userPoolClientId,\n provider,\n customState: input?.customState,\n preferPrivateSession: input?.options?.preferPrivateSession,\n options: {\n loginHint: input?.options?.loginHint,\n lang: input?.options?.lang,\n nonce: input?.options?.nonce,\n },\n });\n}\nexports.signInWithRedirect = signInWithRedirect;\nconst oauthSignIn = async ({ oauthConfig, provider, clientId, customState, preferPrivateSession, options, }) => {\n const { domain, redirectSignIn, responseType, scopes } = oauthConfig;\n const { loginHint, lang, nonce } = options ?? {};\n const randomState = (0, oauth_1.generateState)();\n /* encodeURIComponent is not URL safe, use urlSafeEncode instead. Cognito\n single-encodes/decodes url on first sign in and double-encodes/decodes url\n when user already signed in. Using encodeURIComponent, Base32, Base64 add\n characters % or = which on further encoding becomes unsafe. '=' create issue\n for parsing query params.\n Refer: https://github.com/aws-amplify/amplify-js/issues/5218 */\n const state = customState\n ? `${randomState}-${(0, utils_1.urlSafeEncode)(customState)}`\n : randomState;\n const { value, method, toCodeChallenge } = (0, oauth_1.generateCodeVerifier)(128);\n const redirectUri = (0, oauth_1.getRedirectUrl)(oauthConfig.redirectSignIn);\n if ((0, utils_1.isBrowser)())\n oauth_1.oAuthStore.storeOAuthInFlight(true);\n oauth_1.oAuthStore.storeOAuthState(state);\n oauth_1.oAuthStore.storePKCE(value);\n const queryString = Object.entries({\n redirect_uri: redirectUri,\n response_type: responseType,\n client_id: clientId,\n identity_provider: provider,\n scope: scopes.join(' '),\n // eslint-disable-next-line camelcase\n ...(loginHint && { login_hint: loginHint }),\n ...(lang && { lang }),\n ...(nonce && { nonce }),\n state,\n ...(responseType === 'code' && {\n code_challenge: toCodeChallenge(),\n code_challenge_method: method,\n }),\n })\n .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)\n .join('&');\n // TODO(v6): use URL object instead\n const oAuthUrl = `https://${domain}/oauth2/authorize?${queryString}`;\n // this will only take effect in the following scenarios:\n // 1. the user cancels the OAuth flow on web via back button, and\n // 2. when bfcache is enabled\n (0, cancelOAuthFlow_1.listenForOAuthFlowCancellation)(oauth_1.oAuthStore);\n // the following is effective only in react-native as openAuthSession resolves only in react-native\n const { type, error, url } = (await (0, utils_2.openAuthSession)(oAuthUrl, redirectSignIn, preferPrivateSession)) ??\n {};\n try {\n if (type === 'error') {\n throw (0, createOAuthError_1.createOAuthError)(String(error));\n }\n if (type === 'success' && url) {\n await (0, oauth_1.completeOAuthFlow)({\n currentUrl: url,\n clientId,\n domain,\n redirectUri,\n responseType,\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignInWithRedirect),\n preferPrivateSession,\n });\n }\n }\n catch (err) {\n await (0, oauth_1.handleFailure)(err);\n // rethrow the error so it can be caught by `await signInWithRedirect()` in react-native\n throw err;\n }\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,MAAM;AACnC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,OAAO,CAAC,oCAAoC,CAAC;AAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,gBA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AC;AACzE;AACA,QAAQ,IAAI,IAAI,KAAK,SAAS,IAAI,GAAG,EAAE;AACvC,YAAY,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,iBAAiB,EAAE;AACjD,gBAAgB,UAAU,EAAE,GAAG;AAC/B,gBAAgB,QAAQ;AACxB,gBAAgB,MAAM;AACtB,gBAAgB,WAAW;AAC3B,gBAAgB,YAAY;AAC5B,gBAAgB,cAAc,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC;AACzG,gBAAgB,oBAAoB;AACpC,aAAa,CAAC;AACd;AACA;AACA,IAAI,OAAO,GAAG,EAAE;AAChB,QAAQ,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;AAC7C;AACA,QAAQ,MAAM,GAAG;AACjB;AACA,CAAC;;"}
1
+ {"version":3,"file":"signInWithRedirect.js","sources":["../../../../../src/providers/cognito/apis/signInWithRedirect.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signInWithRedirect = signInWithRedirect;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nrequire(\"../utils/oauth/enableOAuthListener\");\nconst models_1 = require(\"../types/models\");\nconst utils_2 = require(\"../../../utils\");\nconst signInHelpers_1 = require(\"../utils/signInHelpers\");\nconst oauth_1 = require(\"../utils/oauth\");\nconst createOAuthError_1 = require(\"../utils/oauth/createOAuthError\");\nconst cancelOAuthFlow_1 = require(\"../utils/oauth/cancelOAuthFlow\");\n/**\n * Signs in a user with OAuth. Redirects the application to an Identity Provider.\n *\n * @param input - The SignInWithRedirectInput object, if empty it will redirect to Cognito HostedUI\n *\n * @throws AuthTokenConfigException - Thrown when the user pool config is invalid.\n * @throws OAuthNotConfigureException - Thrown when the oauth config is invalid.\n */\nasync function signInWithRedirect(input) {\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n (0, utils_1.assertOAuthConfig)(authConfig);\n oauth_1.oAuthStore.setAuthConfig(authConfig);\n await (0, signInHelpers_1.assertUserNotAuthenticated)();\n let provider = 'COGNITO'; // Default\n if (typeof input?.provider === 'string') {\n provider = models_1.cognitoHostedUIIdentityProviderMap[input.provider];\n }\n else if (input?.provider?.custom) {\n provider = input.provider.custom;\n }\n return oauthSignIn({\n oauthConfig: authConfig.loginWith.oauth,\n clientId: authConfig.userPoolClientId,\n provider,\n customState: input?.customState,\n preferPrivateSession: input?.options?.preferPrivateSession,\n options: {\n loginHint: input?.options?.loginHint,\n lang: input?.options?.lang,\n nonce: input?.options?.nonce,\n },\n });\n}\nconst oauthSignIn = async ({ oauthConfig, provider, clientId, customState, preferPrivateSession, options, }) => {\n const { domain, redirectSignIn, responseType, scopes } = oauthConfig;\n const { loginHint, lang, nonce } = options ?? {};\n const randomState = (0, oauth_1.generateState)();\n /* encodeURIComponent is not URL safe, use urlSafeEncode instead. Cognito\n single-encodes/decodes url on first sign in and double-encodes/decodes url\n when user already signed in. Using encodeURIComponent, Base32, Base64 add\n characters % or = which on further encoding becomes unsafe. '=' create issue\n for parsing query params.\n Refer: https://github.com/aws-amplify/amplify-js/issues/5218 */\n const state = customState\n ? `${randomState}-${(0, utils_1.urlSafeEncode)(customState)}`\n : randomState;\n const { value, method, toCodeChallenge } = (0, oauth_1.generateCodeVerifier)(128);\n const redirectUri = (0, oauth_1.getRedirectUrl)(oauthConfig.redirectSignIn);\n if ((0, utils_1.isBrowser)())\n oauth_1.oAuthStore.storeOAuthInFlight(true);\n oauth_1.oAuthStore.storeOAuthState(state);\n oauth_1.oAuthStore.storePKCE(value);\n const queryString = Object.entries({\n redirect_uri: redirectUri,\n response_type: responseType,\n client_id: clientId,\n identity_provider: provider,\n scope: scopes.join(' '),\n // eslint-disable-next-line camelcase\n ...(loginHint && { login_hint: loginHint }),\n ...(lang && { lang }),\n ...(nonce && { nonce }),\n state,\n ...(responseType === 'code' && {\n code_challenge: toCodeChallenge(),\n code_challenge_method: method,\n }),\n })\n .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)\n .join('&');\n // TODO(v6): use URL object instead\n const oAuthUrl = `https://${domain}/oauth2/authorize?${queryString}`;\n // this will only take effect in the following scenarios:\n // 1. the user cancels the OAuth flow on web via back button, and\n // 2. when bfcache is enabled\n (0, cancelOAuthFlow_1.listenForOAuthFlowCancellation)(oauth_1.oAuthStore);\n // the following is effective only in react-native as openAuthSession resolves only in react-native\n const { type, error, url } = (await (0, utils_2.openAuthSession)(oAuthUrl, redirectSignIn, preferPrivateSession)) ??\n {};\n try {\n if (type === 'error') {\n throw (0, createOAuthError_1.createOAuthError)(String(error));\n }\n if (type === 'success' && url) {\n await (0, oauth_1.completeOAuthFlow)({\n currentUrl: url,\n clientId,\n domain,\n redirectUri,\n responseType,\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignInWithRedirect),\n preferPrivateSession,\n });\n }\n }\n catch (err) {\n await (0, oauth_1.handleFailure)(err);\n // rethrow the error so it can be caught by `await signInWithRedirect()` in react-native\n throw err;\n }\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;AAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,OAAO,CAAC,oCAAoC,CAAC;AAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,eAAe,GAAG,O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AM,CAAC,CAAC,EAAE,OAAO,CAAC,iBAAiB,EAAE;AACjD,gBAAgB,UAAU,EAAE,GAAG;AAC/B,gBAAgB,QAAQ;AACxB,gBAAgB,MAAM;AACtB,gBAAgB,WAAW;AAC3B,gBAAgB,YAAY;AAC5B,gBAAgB,cAAc,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC;AACzG,gBAAgB,oBAAoB;AACpC,aAAa,CAAC;AACd;AACA;AACA,IAAI,OAAO,GAAG,EAAE;AAChB,QAAQ,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;AAC7C;AACA,QAAQ,MAAM,GAAG;AACjB;AACA,CAAC;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.signInWithSRP = void 0;
6
+ exports.signInWithSRP = signInWithSRP;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  const validation_1 = require("../../../errors/types/validation");
@@ -83,5 +83,4 @@ async function signInWithSRP(input) {
83
83
  throw error;
84
84
  }
85
85
  }
86
- exports.signInWithSRP = signInWithSRP;
87
86
  //# sourceMappingURL=signInWithSRP.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signInWithSRP.js","sources":["../../../../../src/providers/cognito/apis/signInWithSRP.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signInWithSRP = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst signInHelpers_1 = require(\"../utils/signInHelpers\");\nconst signInStore_1 = require(\"../../../client/utils/store/signInStore\");\nconst cacheTokens_1 = require(\"../tokenProvider/cacheTokens\");\nconst tokenProvider_1 = require(\"../tokenProvider\");\nconst dispatchSignedInHubEvent_1 = require(\"../utils/dispatchSignedInHubEvent\");\nconst getNewDeviceMetadata_1 = require(\"../utils/getNewDeviceMetadata\");\nconst autoSignIn_1 = require(\"./autoSignIn\");\n/**\n * Signs a user in\n *\n * @param input - The SignInWithSRPInput object\n * @returns SignInWithSRPOutput\n * @throws service: {@link InitiateAuthException }, {@link RespondToAuthChallengeException } - Cognito service errors\n * thrown during the sign-in process.\n * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown when either username or password\n * are not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signInWithSRP(input) {\n const { username, password } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n const signInDetails = {\n loginId: username,\n authFlowType: 'USER_SRP_AUTH',\n };\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const clientMetaData = input.options?.clientMetadata;\n (0, assertValidationError_1.assertValidationError)(!!username, validation_1.AuthValidationErrorCode.EmptySignInUsername);\n (0, assertValidationError_1.assertValidationError)(!!password, validation_1.AuthValidationErrorCode.EmptySignInPassword);\n try {\n const { ChallengeName: handledChallengeName, ChallengeParameters: handledChallengeParameters, AuthenticationResult, Session, } = await (0, signInHelpers_1.handleUserSRPAuthFlow)(username, password, clientMetaData, authConfig, tokenProvider_1.tokenOrchestrator);\n const activeUsername = (0, signInHelpers_1.getActiveSignInUsername)(username);\n // sets up local state used during the sign-in process\n (0, signInStore_1.setActiveSignInState)({\n signInSession: Session,\n username: activeUsername,\n challengeName: handledChallengeName,\n signInDetails,\n });\n if (AuthenticationResult) {\n await (0, cacheTokens_1.cacheCognitoTokens)({\n username: activeUsername,\n ...AuthenticationResult,\n NewDeviceMetadata: await (0, getNewDeviceMetadata_1.getNewDeviceMetadata)({\n userPoolId: authConfig.userPoolId,\n userPoolEndpoint: authConfig.userPoolEndpoint,\n newDeviceMetadata: AuthenticationResult.NewDeviceMetadata,\n accessToken: AuthenticationResult.AccessToken,\n }),\n signInDetails,\n });\n (0, signInStore_1.resetActiveSignInState)();\n await (0, dispatchSignedInHubEvent_1.dispatchSignedInHubEvent)();\n (0, autoSignIn_1.resetAutoSignIn)();\n return {\n isSignedIn: true,\n nextStep: { signInStep: 'DONE' },\n };\n }\n return (0, signInHelpers_1.getSignInResult)({\n challengeName: handledChallengeName,\n challengeParameters: handledChallengeParameters,\n });\n }\n catch (error) {\n (0, signInStore_1.resetActiveSignInState)();\n (0, autoSignIn_1.resetAutoSignIn)();\n (0, assertServiceError_1.assertServiceError)(error);\n const result = (0, signInHelpers_1.getSignInResultFromError)(error.name);\n if (result)\n return result;\n throw error;\n }\n}\nexports.signInWithSRP = signInWithSRP;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,MAAM;AAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAChF,MAAM,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzD,MAAM,aAAa,GAAG,OAAO,CAAC,yCAAyC,CAAC;AACxE,MAAM,aAAa,GAAG,OAAO,CAAC,8BAA8B,CAAC;AAC7D,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACn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QAAQ,IAAI,oBAAoB,CAAC,kBAAkB,EAAE,KAAK,CAAC;AAC3D,QAAQ,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,wBAAwB,EAAE,KAAK,CAAC,IAAI,CAAC;AAChF,QAAQ,IAAI,MAAM;AAClB,YAAY,OAAO,MAAM;AACzB,QAAQ,MAAM,KAAK;AACnB;AACA;AACA,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
1
+ {"version":3,"file":"signInWithSRP.js","sources":["../../../../../src/providers/cognito/apis/signInWithSRP.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signInWithSRP = signInWithSRP;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst signInHelpers_1 = require(\"../utils/signInHelpers\");\nconst signInStore_1 = require(\"../../../client/utils/store/signInStore\");\nconst cacheTokens_1 = require(\"../tokenProvider/cacheTokens\");\nconst tokenProvider_1 = require(\"../tokenProvider\");\nconst dispatchSignedInHubEvent_1 = require(\"../utils/dispatchSignedInHubEvent\");\nconst getNewDeviceMetadata_1 = require(\"../utils/getNewDeviceMetadata\");\nconst autoSignIn_1 = require(\"./autoSignIn\");\n/**\n * Signs a user in\n *\n * @param input - The SignInWithSRPInput object\n * @returns SignInWithSRPOutput\n * @throws service: {@link InitiateAuthException }, {@link RespondToAuthChallengeException } - Cognito service errors\n * thrown during the sign-in process.\n * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown when either username or password\n * are not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signInWithSRP(input) {\n const { username, password } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n const signInDetails = {\n loginId: username,\n authFlowType: 'USER_SRP_AUTH',\n };\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const clientMetaData = input.options?.clientMetadata;\n (0, assertValidationError_1.assertValidationError)(!!username, validation_1.AuthValidationErrorCode.EmptySignInUsername);\n (0, assertValidationError_1.assertValidationError)(!!password, validation_1.AuthValidationErrorCode.EmptySignInPassword);\n try {\n const { ChallengeName: handledChallengeName, ChallengeParameters: handledChallengeParameters, AuthenticationResult, Session, } = await (0, signInHelpers_1.handleUserSRPAuthFlow)(username, password, clientMetaData, authConfig, tokenProvider_1.tokenOrchestrator);\n const activeUsername = (0, signInHelpers_1.getActiveSignInUsername)(username);\n // sets up local state used during the sign-in process\n (0, signInStore_1.setActiveSignInState)({\n signInSession: Session,\n username: activeUsername,\n challengeName: handledChallengeName,\n signInDetails,\n });\n if (AuthenticationResult) {\n await (0, cacheTokens_1.cacheCognitoTokens)({\n username: activeUsername,\n ...AuthenticationResult,\n NewDeviceMetadata: await (0, getNewDeviceMetadata_1.getNewDeviceMetadata)({\n userPoolId: authConfig.userPoolId,\n userPoolEndpoint: authConfig.userPoolEndpoint,\n newDeviceMetadata: AuthenticationResult.NewDeviceMetadata,\n accessToken: AuthenticationResult.AccessToken,\n }),\n signInDetails,\n });\n (0, signInStore_1.resetActiveSignInState)();\n await (0, dispatchSignedInHubEvent_1.dispatchSignedInHubEvent)();\n (0, autoSignIn_1.resetAutoSignIn)();\n return {\n isSignedIn: true,\n nextStep: { signInStep: 'DONE' },\n };\n }\n return (0, signInHelpers_1.getSignInResult)({\n challengeName: handledChallengeName,\n challengeParameters: handledChallengeParameters,\n });\n }\n catch (error) {\n (0, signInStore_1.resetActiveSignInState)();\n (0, autoSignIn_1.resetAutoSignIn)();\n (0, assertServiceError_1.assertServiceError)(error);\n const result = (0, signInHelpers_1.getSignInResultFromError)(error.name);\n if (result)\n return result;\n throw error;\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,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a,CAAC;AACd,YAAY,CAAC,CAAC,EAAE,aAAa,CAAC,sBAAsB,GAAG;AACvD,YAAY,MAAM,CAAC,CAAC,EAAE,0BAA0B,CAAC,wBAAwB,GAAG;AAC5E,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,eAAe,GAAG;AAC/C,YAAY,OAAO;AACnB,gBAAgB,UAAU,EAAE,IAAI;AAChC,gBAAgB,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE;AAChD,aAAa;AACb;AACA,QAAQ,OAAO,CAAC,CAAC,EAAE,eAAe,CAAC,eAAe,EAAE;AACpD,YAAY,aAAa,EAAE,oBAAoB;AAC/C,YAAY,mBAAmB,EAAE,0BAA0B;AAC3D,SAAS,CAAC;AACV;AACA,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,aAAa,CAAC,sBAAsB,GAAG;AACnD,QAAQ,IAAI,YAAY,CAAC,eAAe,GAAG;AAC3C,QAAQ,IAAI,oBAAoB,CAAC,kBAAkB,EAAE,KAAK,CAAC;AAC3D,QAAQ,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,wBAAwB,EAAE,KAAK,CAAC,IAAI,CAAC;AAChF,QAAQ,IAAI,MAAM;AAClB,YAAY,OAAO,MAAM;AACzB,QAAQ,MAAM,KAAK;AACnB;AACA;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.signInWithUserAuth = void 0;
6
+ exports.signInWithUserAuth = signInWithUserAuth;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  const validation_1 = require("../../../errors/types/validation");
@@ -100,5 +100,4 @@ async function signInWithUserAuth(input) {
100
100
  throw error;
101
101
  }
102
102
  }
103
- exports.signInWithUserAuth = signInWithUserAuth;
104
103
  //# sourceMappingURL=signInWithUserAuth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signInWithUserAuth.js","sources":["../../../../../src/providers/cognito/apis/signInWithUserAuth.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signInWithUserAuth = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst signInHelpers_1 = require(\"../utils/signInHelpers\");\nconst store_1 = require(\"../../../client/utils/store\");\nconst signInStore_1 = require(\"../../../client/utils/store/signInStore\");\nconst cacheTokens_1 = require(\"../tokenProvider/cacheTokens\");\nconst dispatchSignedInHubEvent_1 = require(\"../utils/dispatchSignedInHubEvent\");\nconst tokenProvider_1 = require(\"../tokenProvider\");\nconst handleUserAuthFlow_1 = require(\"../../../client/flows/userAuth/handleUserAuthFlow\");\nconst getNewDeviceMetadata_1 = require(\"../utils/getNewDeviceMetadata\");\nconst autoSignIn_1 = require(\"./autoSignIn\");\n/**\n * Signs a user in through a registered email or phone number without a password by by receiving and entering an OTP.\n *\n * @param input - The SignInWithUserAuthInput object\n * @returns SignInWithUserAuthOutput\n * @throws service: {@link InitiateAuthException }, {@link RespondToAuthChallengeException } - Cognito service errors\n * thrown during the sign-in process.\n * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown when either username or password -- needs to change\n * are not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signInWithUserAuth(input) {\n const { username, password, options } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n const signInDetails = {\n loginId: username,\n authFlowType: 'USER_AUTH',\n };\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const clientMetaData = options?.clientMetadata;\n const preferredChallenge = options?.preferredChallenge;\n (0, assertValidationError_1.assertValidationError)(!!username, validation_1.AuthValidationErrorCode.EmptySignInUsername);\n try {\n const handleUserAuthFlowInput = {\n username,\n config: authConfig,\n tokenOrchestrator: tokenProvider_1.tokenOrchestrator,\n clientMetadata: clientMetaData,\n preferredChallenge,\n password,\n };\n const autoSignInStoreState = store_1.autoSignInStore.getState();\n if (autoSignInStoreState.active &&\n autoSignInStoreState.username === username) {\n handleUserAuthFlowInput.session = autoSignInStoreState.session;\n }\n const response = await (0, handleUserAuthFlow_1.handleUserAuthFlow)(handleUserAuthFlowInput);\n const activeUsername = (0, signInHelpers_1.getActiveSignInUsername)(username);\n (0, signInStore_1.setActiveSignInState)({\n signInSession: response.Session,\n username: activeUsername,\n challengeName: response.ChallengeName,\n signInDetails,\n });\n if (response.AuthenticationResult) {\n await (0, cacheTokens_1.cacheCognitoTokens)({\n username: activeUsername,\n ...response.AuthenticationResult,\n NewDeviceMetadata: await (0, getNewDeviceMetadata_1.getNewDeviceMetadata)({\n userPoolId: authConfig.userPoolId,\n userPoolEndpoint: authConfig.userPoolEndpoint,\n newDeviceMetadata: response.AuthenticationResult.NewDeviceMetadata,\n accessToken: response.AuthenticationResult.AccessToken,\n }),\n signInDetails,\n });\n (0, signInStore_1.resetActiveSignInState)();\n await (0, dispatchSignedInHubEvent_1.dispatchSignedInHubEvent)();\n (0, autoSignIn_1.resetAutoSignIn)();\n return {\n isSignedIn: true,\n nextStep: { signInStep: 'DONE' },\n };\n }\n return (0, signInHelpers_1.getSignInResult)({\n challengeName: response.ChallengeName,\n challengeParameters: response.ChallengeParameters,\n availableChallenges: 'AvailableChallenges' in response\n ? response.AvailableChallenges\n : undefined,\n });\n }\n catch (error) {\n (0, signInStore_1.resetActiveSignInState)();\n (0, autoSignIn_1.resetAutoSignIn)();\n (0, assertServiceError_1.assertServiceError)(error);\n const result = (0, signInHelpers_1.getSignInResultFromError)(error.name);\n if (result)\n return result;\n throw error;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EAAE,KAAK,CAAC;AAC3D,QAAQ,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,wBAAwB,EAAE,KAAK,CAAC,IAAI,CAAC;AAChF,QAAQ,IAAI,MAAM;AAClB,YAAY,OAAO,MAAM;AACzB,QAAQ,MAAM,KAAK;AACnB;AACA;AACA,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
1
+ {"version":3,"file":"signInWithUserAuth.js","sources":["../../../../../src/providers/cognito/apis/signInWithUserAuth.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signInWithUserAuth = signInWithUserAuth;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst signInHelpers_1 = require(\"../utils/signInHelpers\");\nconst store_1 = require(\"../../../client/utils/store\");\nconst signInStore_1 = require(\"../../../client/utils/store/signInStore\");\nconst cacheTokens_1 = require(\"../tokenProvider/cacheTokens\");\nconst dispatchSignedInHubEvent_1 = require(\"../utils/dispatchSignedInHubEvent\");\nconst tokenProvider_1 = require(\"../tokenProvider\");\nconst handleUserAuthFlow_1 = require(\"../../../client/flows/userAuth/handleUserAuthFlow\");\nconst getNewDeviceMetadata_1 = require(\"../utils/getNewDeviceMetadata\");\nconst autoSignIn_1 = require(\"./autoSignIn\");\n/**\n * Signs a user in through a registered email or phone number without a password by by receiving and entering an OTP.\n *\n * @param input - The SignInWithUserAuthInput object\n * @returns SignInWithUserAuthOutput\n * @throws service: {@link InitiateAuthException }, {@link RespondToAuthChallengeException } - Cognito service errors\n * thrown during the sign-in process.\n * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown when either username or password -- needs to change\n * are not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signInWithUserAuth(input) {\n const { username, password, options } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n const signInDetails = {\n loginId: username,\n authFlowType: 'USER_AUTH',\n };\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const clientMetaData = options?.clientMetadata;\n const preferredChallenge = options?.preferredChallenge;\n (0, assertValidationError_1.assertValidationError)(!!username, validation_1.AuthValidationErrorCode.EmptySignInUsername);\n try {\n const handleUserAuthFlowInput = {\n username,\n config: authConfig,\n tokenOrchestrator: tokenProvider_1.tokenOrchestrator,\n clientMetadata: clientMetaData,\n preferredChallenge,\n password,\n };\n const autoSignInStoreState = store_1.autoSignInStore.getState();\n if (autoSignInStoreState.active &&\n autoSignInStoreState.username === username) {\n handleUserAuthFlowInput.session = autoSignInStoreState.session;\n }\n const response = await (0, handleUserAuthFlow_1.handleUserAuthFlow)(handleUserAuthFlowInput);\n const activeUsername = (0, signInHelpers_1.getActiveSignInUsername)(username);\n (0, signInStore_1.setActiveSignInState)({\n signInSession: response.Session,\n username: activeUsername,\n challengeName: response.ChallengeName,\n signInDetails,\n });\n if (response.AuthenticationResult) {\n await (0, cacheTokens_1.cacheCognitoTokens)({\n username: activeUsername,\n ...response.AuthenticationResult,\n NewDeviceMetadata: await (0, getNewDeviceMetadata_1.getNewDeviceMetadata)({\n userPoolId: authConfig.userPoolId,\n userPoolEndpoint: authConfig.userPoolEndpoint,\n newDeviceMetadata: response.AuthenticationResult.NewDeviceMetadata,\n accessToken: response.AuthenticationResult.AccessToken,\n }),\n signInDetails,\n });\n (0, signInStore_1.resetActiveSignInState)();\n await (0, dispatchSignedInHubEvent_1.dispatchSignedInHubEvent)();\n (0, autoSignIn_1.resetAutoSignIn)();\n return {\n isSignedIn: true,\n nextStep: { signInStep: 'DONE' },\n };\n }\n return (0, signInHelpers_1.getSignInResult)({\n challengeName: response.ChallengeName,\n challengeParameters: response.ChallengeParameters,\n availableChallenges: 'AvailableChallenges' in response\n ? response.AvailableChallenges\n : undefined,\n });\n }\n catch (error) {\n (0, signInStore_1.resetActiveSignInState)();\n (0, autoSignIn_1.resetAutoSignIn)();\n (0, assertServiceError_1.assertServiceError)(error);\n const result = (0, signInHelpers_1.getSignInResultFromError)(error.name);\n if (result)\n return result;\n throw error;\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;AAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAChF,MAAM,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzD,MAAM,OAAO,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACtD,MAAM,aAAa,GAAG,OAAO,CAAC,yCAAyC,CAAC;AACxE,MAAM,aAAa,GAAG,OAAO,CAAC,8BAA8B,CAAC;AAC7D,MAAM,0BAA0B,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC/E,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACnD,MAAM,oBAAoB,GAAG,OAAO,CAAC,mDAAmD,CAAC;AACzF,MAAM,sBAAsB,GAAG,OAAO,CAAC,+BAA+B,CAAC;AACvE,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,kBAAkB,CAAC,KAAK,EAAE;AACzC,IAAI,MAAM,EAAE,QAAQ,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SAAS;AAC3B,SAAS,CAAC;AACV;AACA,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,aAAa,CAAC,sBAAsB,GAAG;AACnD,QAAQ,IAAI,YAAY,CAAC,eAAe,GAAG;AAC3C,QAAQ,IAAI,oBAAoB,CAAC,kBAAkB,EAAE,KAAK,CAAC;AAC3D,QAAQ,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,wBAAwB,EAAE,KAAK,CAAC,IAAI,CAAC;AAChF,QAAQ,IAAI,MAAM;AAClB,YAAY,OAAO,MAAM;AACzB,QAAQ,MAAM,KAAK;AACnB;AACA;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.signInWithUserPassword = void 0;
6
+ exports.signInWithUserPassword = signInWithUserPassword;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  const validation_1 = require("../../../errors/types/validation");
@@ -83,5 +83,4 @@ async function signInWithUserPassword(input) {
83
83
  throw error;
84
84
  }
85
85
  }
86
- exports.signInWithUserPassword = signInWithUserPassword;
87
86
  //# sourceMappingURL=signInWithUserPassword.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signInWithUserPassword.js","sources":["../../../../../src/providers/cognito/apis/signInWithUserPassword.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signInWithUserPassword = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst signInHelpers_1 = require(\"../utils/signInHelpers\");\nconst signInStore_1 = require(\"../../../client/utils/store/signInStore\");\nconst cacheTokens_1 = require(\"../tokenProvider/cacheTokens\");\nconst tokenProvider_1 = require(\"../tokenProvider\");\nconst dispatchSignedInHubEvent_1 = require(\"../utils/dispatchSignedInHubEvent\");\nconst retryOnResourceNotFoundException_1 = require(\"../utils/retryOnResourceNotFoundException\");\nconst getNewDeviceMetadata_1 = require(\"../utils/getNewDeviceMetadata\");\nconst autoSignIn_1 = require(\"./autoSignIn\");\n/**\n * Signs a user in using USER_PASSWORD_AUTH AuthFlowType\n *\n * @param input - The SignInWithUserPasswordInput object\n * @returns SignInWithUserPasswordOutput\n * @throws service: {@link InitiateAuthException } - Cognito service error thrown during the sign-in process.\n * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown when either username or password\n * are not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signInWithUserPassword(input) {\n const { username, password, options } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n const signInDetails = {\n loginId: username,\n authFlowType: 'USER_PASSWORD_AUTH',\n };\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const metadata = options?.clientMetadata;\n (0, assertValidationError_1.assertValidationError)(!!username, validation_1.AuthValidationErrorCode.EmptySignInUsername);\n (0, assertValidationError_1.assertValidationError)(!!password, validation_1.AuthValidationErrorCode.EmptySignInPassword);\n try {\n const { ChallengeName: retiredChallengeName, ChallengeParameters: retriedChallengeParameters, AuthenticationResult, Session, } = await (0, retryOnResourceNotFoundException_1.retryOnResourceNotFoundException)(signInHelpers_1.handleUserPasswordAuthFlow, [username, password, metadata, authConfig, tokenProvider_1.tokenOrchestrator], username, tokenProvider_1.tokenOrchestrator);\n const activeUsername = (0, signInHelpers_1.getActiveSignInUsername)(username);\n // sets up local state used during the sign-in process\n (0, signInStore_1.setActiveSignInState)({\n signInSession: Session,\n username: activeUsername,\n challengeName: retiredChallengeName,\n signInDetails,\n });\n if (AuthenticationResult) {\n await (0, cacheTokens_1.cacheCognitoTokens)({\n ...AuthenticationResult,\n username: activeUsername,\n NewDeviceMetadata: await (0, getNewDeviceMetadata_1.getNewDeviceMetadata)({\n userPoolId: authConfig.userPoolId,\n userPoolEndpoint: authConfig.userPoolEndpoint,\n newDeviceMetadata: AuthenticationResult.NewDeviceMetadata,\n accessToken: AuthenticationResult.AccessToken,\n }),\n signInDetails,\n });\n (0, signInStore_1.resetActiveSignInState)();\n await (0, dispatchSignedInHubEvent_1.dispatchSignedInHubEvent)();\n (0, autoSignIn_1.resetAutoSignIn)();\n return {\n isSignedIn: true,\n nextStep: { signInStep: 'DONE' },\n };\n }\n return (0, signInHelpers_1.getSignInResult)({\n challengeName: retiredChallengeName,\n challengeParameters: retriedChallengeParameters,\n });\n }\n catch (error) {\n (0, signInStore_1.resetActiveSignInState)();\n (0, autoSignIn_1.resetAutoSignIn)();\n (0, assertServiceError_1.assertServiceError)(error);\n const result = (0, signInHelpers_1.getSignInResultFromError)(error.name);\n if (result)\n return result;\n throw error;\n }\n}\nexports.signInWithUserPassword = signInWithUserPassword;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,sBAAsB,GAAG,MAAM;AACvC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAChF,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzD,MAAM,aAAa,GAAG,OAAO,CAAC,yCAAyC,CAAC;AACxE,MAAM,aAAa,GAAG,OAA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AACpD,YAAY,aAAa,EAAE,oBAAoB;AAC/C,YAAY,mBAAmB,EAAE,0BAA0B;AAC3D,SAAS,CAAC;AACV;AACA,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,aAAa,CAAC,sBAAsB,GAAG;AACnD,QAAQ,IAAI,YAAY,CAAC,eAAe,GAAG;AAC3C,QAAQ,IAAI,oBAAoB,CAAC,kBAAkB,EAAE,KAAK,CAAC;AAC3D,QAAQ,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,wBAAwB,EAAE,KAAK,CAAC,IAAI,CAAC;AAChF,QAAQ,IAAI,MAAM;AAClB,YAAY,OAAO,MAAM;AACzB,QAAQ,MAAM,KAAK;AACnB;AACA;AACA,OAAO,CAAC,sBAAsB,GAAG,sBAAsB;;"}
1
+ {"version":3,"file":"signInWithUserPassword.js","sources":["../../../../../src/providers/cognito/apis/signInWithUserPassword.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signInWithUserPassword = signInWithUserPassword;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst signInHelpers_1 = require(\"../utils/signInHelpers\");\nconst signInStore_1 = require(\"../../../client/utils/store/signInStore\");\nconst cacheTokens_1 = require(\"../tokenProvider/cacheTokens\");\nconst tokenProvider_1 = require(\"../tokenProvider\");\nconst dispatchSignedInHubEvent_1 = require(\"../utils/dispatchSignedInHubEvent\");\nconst retryOnResourceNotFoundException_1 = require(\"../utils/retryOnResourceNotFoundException\");\nconst getNewDeviceMetadata_1 = require(\"../utils/getNewDeviceMetadata\");\nconst autoSignIn_1 = require(\"./autoSignIn\");\n/**\n * Signs a user in using USER_PASSWORD_AUTH AuthFlowType\n *\n * @param input - The SignInWithUserPasswordInput object\n * @returns SignInWithUserPasswordOutput\n * @throws service: {@link InitiateAuthException } - Cognito service error thrown during the sign-in process.\n * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown when either username or password\n * are not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signInWithUserPassword(input) {\n const { username, password, options } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n const signInDetails = {\n loginId: username,\n authFlowType: 'USER_PASSWORD_AUTH',\n };\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const metadata = options?.clientMetadata;\n (0, assertValidationError_1.assertValidationError)(!!username, validation_1.AuthValidationErrorCode.EmptySignInUsername);\n (0, assertValidationError_1.assertValidationError)(!!password, validation_1.AuthValidationErrorCode.EmptySignInPassword);\n try {\n const { ChallengeName: retiredChallengeName, ChallengeParameters: retriedChallengeParameters, AuthenticationResult, Session, } = await (0, retryOnResourceNotFoundException_1.retryOnResourceNotFoundException)(signInHelpers_1.handleUserPasswordAuthFlow, [username, password, metadata, authConfig, tokenProvider_1.tokenOrchestrator], username, tokenProvider_1.tokenOrchestrator);\n const activeUsername = (0, signInHelpers_1.getActiveSignInUsername)(username);\n // sets up local state used during the sign-in process\n (0, signInStore_1.setActiveSignInState)({\n signInSession: Session,\n username: activeUsername,\n challengeName: retiredChallengeName,\n signInDetails,\n });\n if (AuthenticationResult) {\n await (0, cacheTokens_1.cacheCognitoTokens)({\n ...AuthenticationResult,\n username: activeUsername,\n NewDeviceMetadata: await (0, getNewDeviceMetadata_1.getNewDeviceMetadata)({\n userPoolId: authConfig.userPoolId,\n userPoolEndpoint: authConfig.userPoolEndpoint,\n newDeviceMetadata: AuthenticationResult.NewDeviceMetadata,\n accessToken: AuthenticationResult.AccessToken,\n }),\n signInDetails,\n });\n (0, signInStore_1.resetActiveSignInState)();\n await (0, dispatchSignedInHubEvent_1.dispatchSignedInHubEvent)();\n (0, autoSignIn_1.resetAutoSignIn)();\n return {\n isSignedIn: true,\n nextStep: { signInStep: 'DONE' },\n };\n }\n return (0, signInHelpers_1.getSignInResult)({\n challengeName: retiredChallengeName,\n challengeParameters: retriedChallengeParameters,\n });\n }\n catch (error) {\n (0, signInStore_1.resetActiveSignInState)();\n (0, autoSignIn_1.resetAutoSignIn)();\n (0, assertServiceError_1.assertServiceError)(error);\n const result = (0, signInHelpers_1.getSignInResultFromError)(error.name);\n if (result)\n return result;\n throw error;\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,sBAAsB,GAAG,sBAAsB;AACvD,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAChF,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzD,MAAM,aAAa,GAAG,OAAO,CAAC,yCAAyC,CAAC;AACxE,MAAM,aAAa,GAAG,OAAO,CAAC,8BAA8B,CAAC;AAC7D,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACnD,MAAM,0BAA0B,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC/E,MAAM,kCAAkC,GAAG,OAAO,CAAC,2CAA2C,CAAC;AAC/F,MAAM,sBAAsB,GAAG,OAAO,CAAC,+BAA+B,CAAC;AACvE,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB,C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CAAC;AAChF,QAAQ,IAAI,MAAM;AAClB,YAAY,OAAO,MAAM;AACzB,QAAQ,MAAM,KAAK;AACnB;AACA;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.signOut = void 0;
6
+ exports.signOut = signOut;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  const utils_2 = require("../../../utils");
@@ -58,7 +58,6 @@ async function signOut(input) {
58
58
  core_1.Hub.dispatch('auth', { event: 'signedOut' }, 'Auth', utils_1.AMPLIFY_SYMBOL);
59
59
  }
60
60
  }
61
- exports.signOut = signOut;
62
61
  async function clientSignOut(cognitoConfig) {
63
62
  try {
64
63
  const { userPoolEndpoint, userPoolId, userPoolClientId } = cognitoConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"signOut.js","sources":["../../../../../src/providers/cognito/apis/signOut.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signOut = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../../utils\");\nconst tokenProvider_1 = require(\"../tokenProvider\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst oauth_1 = require(\"../utils/oauth\");\nconst signInWithRedirectStore_1 = require(\"../utils/signInWithRedirectStore\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst constants_1 = require(\"../../../errors/constants\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\nconst logger = new core_1.ConsoleLogger('Auth');\n/**\n * Signs a user out\n *\n * @param input - The SignOutInput object\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signOut(input) {\n const cognitoConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(cognitoConfig);\n if (input?.global) {\n await globalSignOut(cognitoConfig);\n }\n else {\n await clientSignOut(cognitoConfig);\n }\n let hasOAuthConfig;\n try {\n (0, utils_1.assertOAuthConfig)(cognitoConfig);\n hasOAuthConfig = true;\n }\n catch (err) {\n hasOAuthConfig = false;\n }\n if (hasOAuthConfig) {\n const oAuthStore = new signInWithRedirectStore_1.DefaultOAuthStore(core_1.defaultStorage);\n oAuthStore.setAuthConfig(cognitoConfig);\n const { type } = (await (0, oauth_1.handleOAuthSignOut)(cognitoConfig, oAuthStore, tokenProvider_1.tokenOrchestrator, input?.oauth?.redirectUrl)) ?? {};\n if (type === 'error') {\n throw new AuthError_1.AuthError({\n name: constants_1.OAUTH_SIGNOUT_EXCEPTION,\n message: `An error occurred when attempting to log out from OAuth provider.`,\n });\n }\n }\n else {\n // complete sign out\n tokenProvider_1.tokenOrchestrator.clearTokens();\n await (0, core_1.clearCredentials)();\n core_1.Hub.dispatch('auth', { event: 'signedOut' }, 'Auth', utils_1.AMPLIFY_SYMBOL);\n }\n}\nexports.signOut = signOut;\nasync function clientSignOut(cognitoConfig) {\n try {\n const { userPoolEndpoint, userPoolId, userPoolClientId } = cognitoConfig;\n const authTokens = await tokenProvider_1.tokenOrchestrator.getTokenStore().loadTokens();\n (0, types_1.assertAuthTokensWithRefreshToken)(authTokens);\n if (isSessionRevocable(authTokens.accessToken)) {\n const revokeToken = (0, cognitoIdentityProvider_1.createRevokeTokenClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await revokeToken({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignOut),\n }, {\n ClientId: userPoolClientId,\n Token: authTokens.refreshToken,\n });\n }\n }\n catch (err) {\n // this shouldn't throw\n logger.debug('Client signOut error caught but will proceed with token removal');\n }\n}\nasync function globalSignOut(cognitoConfig) {\n try {\n const { userPoolEndpoint, userPoolId } = cognitoConfig;\n const authTokens = await tokenProvider_1.tokenOrchestrator.getTokenStore().loadTokens();\n (0, types_1.assertAuthTokens)(authTokens);\n const globalSignOutClient = (0, cognitoIdentityProvider_1.createGlobalSignOutClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await globalSignOutClient({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignOut),\n }, {\n AccessToken: authTokens.accessToken.toString(),\n });\n }\n catch (err) {\n // it should not throw\n logger.debug('Global signOut error caught but will proceed with token removal');\n }\n}\nconst isSessionRevocable = (token) => !!token?.payload?.origin_jti;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,OAAO,GAAG,MAAM;AACxB,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACnD,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,yBAAyB,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAC7E,MAAM,WAAW,GAAG,OAAO,CAAC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AC,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU;;"}
1
+ {"version":3,"file":"signOut.js","sources":["../../../../../src/providers/cognito/apis/signOut.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signOut = signOut;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../../utils\");\nconst tokenProvider_1 = require(\"../tokenProvider\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst oauth_1 = require(\"../utils/oauth\");\nconst signInWithRedirectStore_1 = require(\"../utils/signInWithRedirectStore\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst constants_1 = require(\"../../../errors/constants\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\nconst logger = new core_1.ConsoleLogger('Auth');\n/**\n * Signs a user out\n *\n * @param input - The SignOutInput object\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signOut(input) {\n const cognitoConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(cognitoConfig);\n if (input?.global) {\n await globalSignOut(cognitoConfig);\n }\n else {\n await clientSignOut(cognitoConfig);\n }\n let hasOAuthConfig;\n try {\n (0, utils_1.assertOAuthConfig)(cognitoConfig);\n hasOAuthConfig = true;\n }\n catch (err) {\n hasOAuthConfig = false;\n }\n if (hasOAuthConfig) {\n const oAuthStore = new signInWithRedirectStore_1.DefaultOAuthStore(core_1.defaultStorage);\n oAuthStore.setAuthConfig(cognitoConfig);\n const { type } = (await (0, oauth_1.handleOAuthSignOut)(cognitoConfig, oAuthStore, tokenProvider_1.tokenOrchestrator, input?.oauth?.redirectUrl)) ?? {};\n if (type === 'error') {\n throw new AuthError_1.AuthError({\n name: constants_1.OAUTH_SIGNOUT_EXCEPTION,\n message: `An error occurred when attempting to log out from OAuth provider.`,\n });\n }\n }\n else {\n // complete sign out\n tokenProvider_1.tokenOrchestrator.clearTokens();\n await (0, core_1.clearCredentials)();\n core_1.Hub.dispatch('auth', { event: 'signedOut' }, 'Auth', utils_1.AMPLIFY_SYMBOL);\n }\n}\nasync function clientSignOut(cognitoConfig) {\n try {\n const { userPoolEndpoint, userPoolId, userPoolClientId } = cognitoConfig;\n const authTokens = await tokenProvider_1.tokenOrchestrator.getTokenStore().loadTokens();\n (0, types_1.assertAuthTokensWithRefreshToken)(authTokens);\n if (isSessionRevocable(authTokens.accessToken)) {\n const revokeToken = (0, cognitoIdentityProvider_1.createRevokeTokenClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await revokeToken({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignOut),\n }, {\n ClientId: userPoolClientId,\n Token: authTokens.refreshToken,\n });\n }\n }\n catch (err) {\n // this shouldn't throw\n logger.debug('Client signOut error caught but will proceed with token removal');\n }\n}\nasync function globalSignOut(cognitoConfig) {\n try {\n const { userPoolEndpoint, userPoolId } = cognitoConfig;\n const authTokens = await tokenProvider_1.tokenOrchestrator.getTokenStore().loadTokens();\n (0, types_1.assertAuthTokens)(authTokens);\n const globalSignOutClient = (0, cognitoIdentityProvider_1.createGlobalSignOutClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await globalSignOutClient({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignOut),\n }, {\n AccessToken: authTokens.accessToken.toString(),\n });\n }\n catch (err) {\n // it should not throw\n logger.debug('Global signOut error caught but will proceed with token removal');\n }\n}\nconst isSessionRevocable = (token) => !!token?.payload?.origin_jti;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,OAAO,GAAG,OAAO;AACzB,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACnD,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,yBAAyB,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAC7E,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC;AACjH,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;AAC3C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,CAAC,KAAK,EAAE;AAC9B,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO;AAClE,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,aAAa,CAAC;AACzD,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE;AACvB,QAAQ,MAAM,aAAa,CAAC,aAAa,CAAC;AAC1C;AACA,SAAS;AACT,QAAQ,MA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,CAAC,yBAAyB,EAAE;AAC7F,YAAY,gBAAgB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,qCAAqC,EAAE;AACrF,gBAAgB,gBAAgB,EAAE,gBAAgB;AAClD,aAAa,CAAC;AACd,SAAS,CAAC;AACV,QAAQ,MAAM,mBAAmB,CAAC;AAClC,YAAY,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,uBAAuB,EAAE,UAAU,CAAC;AACtE,YAAY,cAAc,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;AAC1F,SAAS,EAAE;AACX,YAAY,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE;AAC1D,SAAS,CAAC;AACV;AACA,IAAI,OAAO,GAAG,EAAE;AAChB;AACA,QAAQ,MAAM,CAAC,KAAK,CAAC,iEAAiE,CAAC;AACvF;AACA;AACA,MAAM,kBAAkB,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.signUp = void 0;
6
+ exports.signUp = signUp;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  const assertValidationError_1 = require("../../../errors/utils/assertValidationError");
@@ -131,5 +131,4 @@ async function signUp(input) {
131
131
  userId,
132
132
  };
133
133
  }
134
- exports.signUp = signUp;
135
134
  //# sourceMappingURL=signUp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signUp.js","sources":["../../../../../src/providers/cognito/apis/signUp.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signUp = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst apiHelpers_1 = require(\"../utils/apiHelpers\");\nconst signUpHelpers_1 = require(\"../utils/signUpHelpers\");\nconst userContextData_1 = require(\"../utils/userContextData\");\nconst utils_2 = require(\"../../../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\nconst store_1 = require(\"../../../client/utils/store\");\nconst autoSignIn_1 = require(\"./autoSignIn\");\n/**\n * Creates a user\n *\n * @param input - The SignUpInput object\n * @returns SignUpOutput\n * @throws service: {@link SignUpException } - Cognito service errors thrown during the sign-up process.\n * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown either username or password\n * are not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signUp(input) {\n const { username, password, options } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n const signUpVerificationMethod = authConfig?.signUpVerificationMethod ?? 'code';\n const { clientMetadata, validationData, autoSignIn } = input.options ?? {};\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n (0, assertValidationError_1.assertValidationError)(!!username, validation_1.AuthValidationErrorCode.EmptySignUpUsername);\n const signInServiceOptions = typeof autoSignIn !== 'boolean' ? autoSignIn : undefined;\n const signInInput = {\n username,\n options: signInServiceOptions,\n };\n // if the authFlowType is 'CUSTOM_WITHOUT_SRP' then we don't include the password\n if (signInServiceOptions?.authFlowType !== 'CUSTOM_WITHOUT_SRP') {\n signInInput.password = password;\n }\n const { userPoolId, userPoolClientId, userPoolEndpoint } = authConfig;\n const signUpClient = (0, cognitoIdentityProvider_1.createSignUpClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const signUpClientInput = {\n Username: username,\n Password: undefined,\n UserAttributes: options?.userAttributes && (0, apiHelpers_1.toAttributeType)(options?.userAttributes),\n ClientMetadata: clientMetadata,\n ValidationData: validationData && (0, apiHelpers_1.toAttributeType)(validationData),\n ClientId: userPoolClientId,\n UserContextData: (0, userContextData_1.getUserContextData)({\n username,\n userPoolId,\n userPoolClientId,\n }),\n };\n if (password) {\n signUpClientInput.Password = password;\n }\n const { UserSub: userId, CodeDeliveryDetails: cdd, UserConfirmed: userConfirmed, Session: session, } = await signUpClient({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignUp),\n }, signUpClientInput);\n if (signInServiceOptions || autoSignIn === true) {\n store_1.autoSignInStore.dispatch({ type: 'START' });\n store_1.autoSignInStore.dispatch({ type: 'SET_USERNAME', value: username });\n store_1.autoSignInStore.dispatch({ type: 'SET_SESSION', value: session });\n }\n const codeDeliveryDetails = {\n destination: cdd?.Destination,\n deliveryMedium: cdd?.DeliveryMedium,\n attributeName: cdd?.AttributeName,\n };\n const isSignUpComplete = !!userConfirmed;\n const isAutoSignInStarted = store_1.autoSignInStore.getState().active;\n // Sign Up Complete\n // No Confirm Sign In Step Required\n if (isSignUpComplete) {\n if (isAutoSignInStarted) {\n (0, autoSignIn_1.setAutoSignIn)((0, signUpHelpers_1.autoSignInUserConfirmed)(signInInput));\n return {\n isSignUpComplete: true,\n nextStep: {\n signUpStep: 'COMPLETE_AUTO_SIGN_IN',\n },\n userId,\n };\n }\n return {\n isSignUpComplete: true,\n nextStep: {\n signUpStep: 'DONE',\n },\n userId,\n };\n }\n // Sign Up Not Complete\n // Confirm Sign Up Step Required\n if (isAutoSignInStarted) {\n // Confirmation Via Link Occurs In Separate Context\n // AutoSignIn Fn Will Initiate Polling Once Executed\n if (signUpVerificationMethod === 'link') {\n (0, autoSignIn_1.setAutoSignIn)((0, signUpHelpers_1.autoSignInWhenUserIsConfirmedWithLink)(signInInput));\n return {\n isSignUpComplete: false,\n nextStep: {\n signUpStep: 'COMPLETE_AUTO_SIGN_IN',\n codeDeliveryDetails,\n },\n userId,\n };\n }\n // Confirmation Via Code Occurs In Same Context\n // AutoSignIn Next Step Will Be Returned From Confirm Sign Up\n (0, signUpHelpers_1.handleCodeAutoSignIn)(signInInput);\n }\n return {\n isSignUpComplete: false,\n nextStep: {\n signUpStep: 'CONFIRM_SIGN_UP',\n codeDeliveryDetails,\n },\n userId,\n };\n}\nexports.signUp = signUp;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,MAAM,GAAG,MAAM;AACvB,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;AACnD,MAAM,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzD,MAAM,iBAAiB,GAAG,OAAO,CAAC,0BAA0B,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC;AACjH,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACtD,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AAgB,EAAE,KAAK;AAC/B,QAAQ,QAAQ,EAAE;AAClB,YAAY,UAAU,EAAE,iBAAiB;AACzC,YAAY,mBAAmB;AAC/B,SAAS;AACT,QAAQ,MAAM;AACd,KAAK;AACL;AACA,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"signUp.js","sources":["../../../../../src/providers/cognito/apis/signUp.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signUp = signUp;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst apiHelpers_1 = require(\"../utils/apiHelpers\");\nconst signUpHelpers_1 = require(\"../utils/signUpHelpers\");\nconst userContextData_1 = require(\"../utils/userContextData\");\nconst utils_2 = require(\"../../../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\nconst store_1 = require(\"../../../client/utils/store\");\nconst autoSignIn_1 = require(\"./autoSignIn\");\n/**\n * Creates a user\n *\n * @param input - The SignUpInput object\n * @returns SignUpOutput\n * @throws service: {@link SignUpException } - Cognito service errors thrown during the sign-up process.\n * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown either username or password\n * are not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function signUp(input) {\n const { username, password, options } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n const signUpVerificationMethod = authConfig?.signUpVerificationMethod ?? 'code';\n const { clientMetadata, validationData, autoSignIn } = input.options ?? {};\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n (0, assertValidationError_1.assertValidationError)(!!username, validation_1.AuthValidationErrorCode.EmptySignUpUsername);\n const signInServiceOptions = typeof autoSignIn !== 'boolean' ? autoSignIn : undefined;\n const signInInput = {\n username,\n options: signInServiceOptions,\n };\n // if the authFlowType is 'CUSTOM_WITHOUT_SRP' then we don't include the password\n if (signInServiceOptions?.authFlowType !== 'CUSTOM_WITHOUT_SRP') {\n signInInput.password = password;\n }\n const { userPoolId, userPoolClientId, userPoolEndpoint } = authConfig;\n const signUpClient = (0, cognitoIdentityProvider_1.createSignUpClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const signUpClientInput = {\n Username: username,\n Password: undefined,\n UserAttributes: options?.userAttributes && (0, apiHelpers_1.toAttributeType)(options?.userAttributes),\n ClientMetadata: clientMetadata,\n ValidationData: validationData && (0, apiHelpers_1.toAttributeType)(validationData),\n ClientId: userPoolClientId,\n UserContextData: (0, userContextData_1.getUserContextData)({\n username,\n userPoolId,\n userPoolClientId,\n }),\n };\n if (password) {\n signUpClientInput.Password = password;\n }\n const { UserSub: userId, CodeDeliveryDetails: cdd, UserConfirmed: userConfirmed, Session: session, } = await signUpClient({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignUp),\n }, signUpClientInput);\n if (signInServiceOptions || autoSignIn === true) {\n store_1.autoSignInStore.dispatch({ type: 'START' });\n store_1.autoSignInStore.dispatch({ type: 'SET_USERNAME', value: username });\n store_1.autoSignInStore.dispatch({ type: 'SET_SESSION', value: session });\n }\n const codeDeliveryDetails = {\n destination: cdd?.Destination,\n deliveryMedium: cdd?.DeliveryMedium,\n attributeName: cdd?.AttributeName,\n };\n const isSignUpComplete = !!userConfirmed;\n const isAutoSignInStarted = store_1.autoSignInStore.getState().active;\n // Sign Up Complete\n // No Confirm Sign In Step Required\n if (isSignUpComplete) {\n if (isAutoSignInStarted) {\n (0, autoSignIn_1.setAutoSignIn)((0, signUpHelpers_1.autoSignInUserConfirmed)(signInInput));\n return {\n isSignUpComplete: true,\n nextStep: {\n signUpStep: 'COMPLETE_AUTO_SIGN_IN',\n },\n userId,\n };\n }\n return {\n isSignUpComplete: true,\n nextStep: {\n signUpStep: 'DONE',\n },\n userId,\n };\n }\n // Sign Up Not Complete\n // Confirm Sign Up Step Required\n if (isAutoSignInStarted) {\n // Confirmation Via Link Occurs In Separate Context\n // AutoSignIn Fn Will Initiate Polling Once Executed\n if (signUpVerificationMethod === 'link') {\n (0, autoSignIn_1.setAutoSignIn)((0, signUpHelpers_1.autoSignInWhenUserIsConfirmedWithLink)(signInInput));\n return {\n isSignUpComplete: false,\n nextStep: {\n signUpStep: 'COMPLETE_AUTO_SIGN_IN',\n codeDeliveryDetails,\n },\n userId,\n };\n }\n // Confirmation Via Code Occurs In Same Context\n // AutoSignIn Next Step Will Be Returned From Confirm Sign Up\n (0, signUpHelpers_1.handleCodeAutoSignIn)(signInInput);\n }\n return {\n isSignUpComplete: false,\n nextStep: {\n signUpStep: 'CONFIRM_SIGN_UP',\n codeDeliveryDetails,\n },\n userId,\n };\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,MAAM,GAAG,MAAM;AACvB,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;AACnD,MAAM,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACzD,MAAM,i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AC,qCAAqC,EAAE,WAAW,CAAC,CAAC;AACpH,YAAY,OAAO;AACnB,gBAAgB,gBAAgB,EAAE,KAAK;AACvC,gBAAgB,QAAQ,EAAE;AAC1B,oBAAoB,UAAU,EAAE,uBAAuB;AACvD,oBAAoB,mBAAmB;AACvC,iBAAiB;AACjB,gBAAgB,MAAM;AACtB,aAAa;AACb;AACA;AACA;AACA,QAAQ,IAAI,eAAe,CAAC,oBAAoB,EAAE,WAAW,CAAC;AAC9D;AACA,IAAI,OAAO;AACX,QAAQ,gBAAgB,EAAE,KAAK;AAC/B,QAAQ,QAAQ,EAAE;AAClB,YAAY,UAAU,EAAE,iBAAiB;AACzC,YAAY,mBAAmB;AAC/B,SAAS;AACT,QAAQ,MAAM;AACd,KAAK;AACL;;"}
@@ -3,7 +3,8 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getMFASettings = exports.updateMFAPreference = void 0;
6
+ exports.updateMFAPreference = updateMFAPreference;
7
+ exports.getMFASettings = getMFASettings;
7
8
  const core_1 = require("@aws-amplify/core");
8
9
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
10
  const parsers_1 = require("../../../foundation/parsers");
@@ -40,7 +41,6 @@ async function updateMFAPreference(input) {
40
41
  EmailMfaSettings: getMFASettings(email),
41
42
  });
42
43
  }
43
- exports.updateMFAPreference = updateMFAPreference;
44
44
  function getMFASettings(mfaPreference) {
45
45
  if (mfaPreference === 'DISABLED') {
46
46
  return {
@@ -65,5 +65,4 @@ function getMFASettings(mfaPreference) {
65
65
  };
66
66
  }
67
67
  }
68
- exports.getMFASettings = getMFASettings;
69
68
  //# sourceMappingURL=updateMFAPreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateMFAPreference.js","sources":["../../../../../src/providers/cognito/apis/updateMFAPreference.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getMFASettings = exports.updateMFAPreference = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst utils_2 = require(\"../../../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\n/**\n * Updates the MFA preference of the user.\n *\n * @param input - The UpdateMFAPreferenceInput object.\n * @throws -{@link SetUserMFAPreferenceException } - Service error thrown when the MFA preference cannot be updated.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function updateMFAPreference(input) {\n const { sms, totp, email } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { tokens } = await (0, core_1.fetchAuthSession)({ forceRefresh: false });\n (0, types_1.assertAuthTokens)(tokens);\n const setUserMFAPreference = (0, cognitoIdentityProvider_1.createSetUserMFAPreferenceClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await setUserMFAPreference({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.UpdateMFAPreference),\n }, {\n AccessToken: tokens.accessToken.toString(),\n SMSMfaSettings: getMFASettings(sms),\n SoftwareTokenMfaSettings: getMFASettings(totp),\n EmailMfaSettings: getMFASettings(email),\n });\n}\nexports.updateMFAPreference = updateMFAPreference;\nfunction getMFASettings(mfaPreference) {\n if (mfaPreference === 'DISABLED') {\n return {\n Enabled: false,\n };\n }\n else if (mfaPreference === 'PREFERRED') {\n return {\n Enabled: true,\n PreferredMfa: true,\n };\n }\n else if (mfaPreference === 'ENABLED') {\n return {\n Enabled: true,\n };\n }\n else if (mfaPreference === 'NOT_PREFERRED') {\n return {\n Enabled: true,\n PreferredMfa: false,\n };\n }\n}\nexports.getMFASettings = getMFASettings;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,mBAAmB,GAAG,MAAM;AAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC;AACjH,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,mBAAmB,CAAC,KAAK,EAAE;AAC1C,IAAI,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK;AACtC,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO;AAC/D,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,UAAU,CAAC;AACtD,IAAI,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,UAAU;AACvD,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AAClF,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC;A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AO,CAAC,cAAc,GAAG,cAAc;;"}
1
+ {"version":3,"file":"updateMFAPreference.js","sources":["../../../../../src/providers/cognito/apis/updateMFAPreference.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateMFAPreference = updateMFAPreference;\nexports.getMFASettings = getMFASettings;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst utils_2 = require(\"../../../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\n/**\n * Updates the MFA preference of the user.\n *\n * @param input - The UpdateMFAPreferenceInput object.\n * @throws -{@link SetUserMFAPreferenceException } - Service error thrown when the MFA preference cannot be updated.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function updateMFAPreference(input) {\n const { sms, totp, email } = input;\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { tokens } = await (0, core_1.fetchAuthSession)({ forceRefresh: false });\n (0, types_1.assertAuthTokens)(tokens);\n const setUserMFAPreference = (0, cognitoIdentityProvider_1.createSetUserMFAPreferenceClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await setUserMFAPreference({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.UpdateMFAPreference),\n }, {\n AccessToken: tokens.accessToken.toString(),\n SMSMfaSettings: getMFASettings(sms),\n SoftwareTokenMfaSettings: getMFASettings(totp),\n EmailMfaSettings: getMFASettings(email),\n });\n}\nfunction getMFASettings(mfaPreference) {\n if (mfaPreference === 'DISABLED') {\n return {\n Enabled: false,\n };\n }\n else if (mfaPreference === 'PREFERRED') {\n return {\n Enabled: true,\n PreferredMfa: true,\n };\n }\n else if (mfaPreference === 'ENABLED') {\n return {\n Enabled: true,\n };\n }\n else if (mfaPreference === 'NOT_PREFERRED') {\n return {\n Enabled: true,\n PreferredMfa: false,\n };\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;AACjD,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC;AACjH,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,mBAAmB,CAAC,KAAK,EAAE;AAC1C,IAAI,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK;AACtC,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO;AAC/D,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,UAAU,CAAC;AACtD,IAAI,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,UAAU;AACvD,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,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,OAAO,EAAE,IAAI;AACzB,YAAY,YAAY,EAAE,KAAK;AAC/B,SAAS;AACT;AACA;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updatePassword = void 0;
6
+ exports.updatePassword = updatePassword;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  const validation_1 = require("../../../errors/types/validation");
@@ -44,5 +44,4 @@ async function updatePassword(input) {
44
44
  ProposedPassword: newPassword,
45
45
  });
46
46
  }
47
- exports.updatePassword = updatePassword;
48
47
  //# sourceMappingURL=updatePassword.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updatePassword.js","sources":["../../../../../src/providers/cognito/apis/updatePassword.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updatePassword = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst utils_2 = require(\"../../../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\n/**\n * Updates user's password while authenticated.\n *\n * @param input - The UpdatePasswordInput object.\n * @throws - {@link ChangePasswordException} - Cognito service errors thrown when updating a password.\n * @throws - {@link AuthValidationErrorCode} - Validation errors thrown when oldPassword or newPassword are empty.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function updatePassword(input) {\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { oldPassword, newPassword } = input;\n (0, assertValidationError_1.assertValidationError)(!!oldPassword, validation_1.AuthValidationErrorCode.EmptyUpdatePassword);\n (0, assertValidationError_1.assertValidationError)(!!newPassword, validation_1.AuthValidationErrorCode.EmptyUpdatePassword);\n const { tokens } = await (0, core_1.fetchAuthSession)({ forceRefresh: false });\n (0, types_1.assertAuthTokens)(tokens);\n const changePassword = (0, cognitoIdentityProvider_1.createChangePasswordClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await changePassword({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.UpdatePassword),\n }, {\n AccessToken: tokens.accessToken.toString(),\n PreviousPassword: oldPassword,\n ProposedPassword: newPassword,\n });\n}\nexports.updatePassword = updatePassword;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,MAAM;AAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC;AACjH,MAAM,WAAW,GAAG,OAAO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AE;AAClD,QAAQ,gBAAgB,EAAE,WAAW;AACrC,QAAQ,gBAAgB,EAAE,WAAW;AACrC,KAAK,CAAC;AACN;AACA,OAAO,CAAC,cAAc,GAAG,cAAc;;"}
1
+ {"version":3,"file":"updatePassword.js","sources":["../../../../../src/providers/cognito/apis/updatePassword.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updatePassword = updatePassword;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst utils_2 = require(\"../../../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\n/**\n * Updates user's password while authenticated.\n *\n * @param input - The UpdatePasswordInput object.\n * @throws - {@link ChangePasswordException} - Cognito service errors thrown when updating a password.\n * @throws - {@link AuthValidationErrorCode} - Validation errors thrown when oldPassword or newPassword are empty.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function updatePassword(input) {\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { oldPassword, newPassword } = input;\n (0, assertValidationError_1.assertValidationError)(!!oldPassword, validation_1.AuthValidationErrorCode.EmptyUpdatePassword);\n (0, assertValidationError_1.assertValidationError)(!!newPassword, validation_1.AuthValidationErrorCode.EmptyUpdatePassword);\n const { tokens } = await (0, core_1.fetchAuthSession)({ forceRefresh: false });\n (0, types_1.assertAuthTokens)(tokens);\n const changePassword = (0, cognitoIdentityProvider_1.createChangePasswordClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await changePassword({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.UpdatePassword),\n }, {\n AccessToken: tokens.accessToken.toString(),\n PreviousPassword: oldPassword,\n ProposedPassword: newPassword,\n });\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC;AACjH,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc,CAAC,KAAK,EAAE;AACrC,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO;AAC/D,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,UAAU,CAAC;AACtD,IAAI,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,UAAU;AACvD,IAAI,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,KAAK;AAC9C,IAAI,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,CAAC,WAAW,EAAE,YAAY,CAAC,uBAAuB,CAAC,mBAAmB,CAAC;AAC/H,IAAI,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,CAAC,WAAW,EAAE,YAAY,CAAC,uBAAuB,CAAC,mBAAmB,CAAC;AAC/H,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AAClF,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC;AACzC,IAAI,MAAM,cAAc,GAAG,IAAI,yBAAyB,CAAC,0BAA0B,EAAE;AACrF,QAAQ,gBAAgB,EAAE,IAAI,WAAW,CAAC,qCAAqC,EAAE;AACjF,YAAY,gBAAgB,EAAE,gBAAgB;AAC9C,SAAS,CAAC;AACV,KAAK,CAAC;AACN,IAAI,MAAM,cAAc,CAAC;AACzB,QAAQ,MAAM,EAAE,IAAI,SAAS,CAAC,uBAAuB,EAAE,UAAU,CAAC;AAClE,QAAQ,cAAc,EAAE,IAAI,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;AAC7F,KAAK,EAAE;AACP,QAAQ,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClD,QAAQ,gBAAgB,EAAE,WAAW;AACrC,QAAQ,gBAAgB,EAAE,WAAW;AACrC,KAAK,CAAC;AACN;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.verifyTOTPSetup = void 0;
6
+ exports.verifyTOTPSetup = verifyTOTPSetup;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
9
  const validation_1 = require("../../../errors/types/validation");
@@ -45,5 +45,4 @@ async function verifyTOTPSetup(input) {
45
45
  FriendlyDeviceName: options?.friendlyDeviceName,
46
46
  });
47
47
  }
48
- exports.verifyTOTPSetup = verifyTOTPSetup;
49
48
  //# sourceMappingURL=verifyTOTPSetup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifyTOTPSetup.js","sources":["../../../../../src/providers/cognito/apis/verifyTOTPSetup.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.verifyTOTPSetup = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst utils_2 = require(\"../../../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\n/**\n * Verifies an OTP code retrieved from an associated authentication app.\n *\n * @param input - The VerifyTOTPSetupInput\n * @throws -{@link VerifySoftwareTokenException }:\n * Thrown due to an invalid MFA token.\n * @throws -{@link AuthValidationErrorCode }:\n * Thrown when `code` is not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function verifyTOTPSetup(input) {\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { code, options } = input;\n (0, assertValidationError_1.assertValidationError)(!!code, validation_1.AuthValidationErrorCode.EmptyVerifyTOTPSetupCode);\n const { tokens } = await (0, core_1.fetchAuthSession)({ forceRefresh: false });\n (0, types_1.assertAuthTokens)(tokens);\n const verifySoftwareToken = (0, cognitoIdentityProvider_1.createVerifySoftwareTokenClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await verifySoftwareToken({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.VerifyTOTPSetup),\n }, {\n AccessToken: tokens.accessToken.toString(),\n UserCode: code,\n FriendlyDeviceName: options?.friendlyDeviceName,\n });\n}\nexports.verifyTOTPSetup = verifyTOTPSetup;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,MAAM;AAChC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAChE,MAAM,uBAAuB,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACtF,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC;AACjH,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe,CAAC,KAAK,EAAE;AACtC,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO;AAC/D,IAAI,IAAI,OAAO,CAAC,yBAAyB,EAAE,UAAU,CAAC;AACtD,IAAI,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,UAAU;AACvD,IAAI,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK;AACnC,IAAI,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,uBAAuB,CAAC,wBAAwB,CAAC;AAC7H,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AAClF,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC;AACzC,IAAI,MAAM,mBAAmB,GAAG,IAAI,yBAAyB,CAAC,+BAA+B,EAAE;AAC/F,QAAQ,gBAAgB,EAAE,IAAI,WAAW,CAAC,qCAAqC,EAAE;AACjF,YAAY,gBAAgB,EAAE,gBAAgB;AAC9C,SAAS,CAAC;AACV,KAAK,CAAC;AACN,IAAI,MAAM,mBAAmB,CAAC;AAC9B,QAAQ,MAAM,EAAE,IAAI,SAAS,CAAC,uBAAuB,EAAE,UAAU,CAAC;AAClE,QAAQ,cAAc,EAAE,IAAI,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC;AAC9F,KAAK,EAAE;AACP,QAAQ,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClD,QAAQ,QAAQ,EAAE,IAAI;AACtB,QAAQ,kBAAkB,EAAE,OAAO,EAAE,kBAAkB;AACvD,KAAK,CAAC;AACN;AACA,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
1
+ {"version":3,"file":"verifyTOTPSetup.js","sources":["../../../../../src/providers/cognito/apis/verifyTOTPSetup.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.verifyTOTPSetup = verifyTOTPSetup;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst utils_2 = require(\"../../../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../factories\");\n/**\n * Verifies an OTP code retrieved from an associated authentication app.\n *\n * @param input - The VerifyTOTPSetupInput\n * @throws -{@link VerifySoftwareTokenException }:\n * Thrown due to an invalid MFA token.\n * @throws -{@link AuthValidationErrorCode }:\n * Thrown when `code` is not defined.\n * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.\n */\nasync function verifyTOTPSetup(input) {\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { code, options } = input;\n (0, assertValidationError_1.assertValidationError)(!!code, validation_1.AuthValidationErrorCode.EmptyVerifyTOTPSetupCode);\n const { tokens } = await (0, core_1.fetchAuthSession)({ forceRefresh: false });\n (0, types_1.assertAuthTokens)(tokens);\n const verifySoftwareToken = (0, cognitoIdentityProvider_1.createVerifySoftwareTokenClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await verifySoftwareToken({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.VerifyTOTPSetup),\n }, {\n AccessToken: tokens.accessToken.toString(),\n UserCode: code,\n FriendlyDeviceName: options?.friendlyDeviceName,\n });\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,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W,CAAC,qCAAqC,EAAE;AACjF,YAAY,gBAAgB,EAAE,gBAAgB;AAC9C,SAAS,CAAC;AACV,KAAK,CAAC;AACN,IAAI,MAAM,mBAAmB,CAAC;AAC9B,QAAQ,MAAM,EAAE,IAAI,SAAS,CAAC,uBAAuB,EAAE,UAAU,CAAC;AAClE,QAAQ,cAAc,EAAE,IAAI,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC;AAC9F,KAAK,EAAE;AACP,QAAQ,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClD,QAAQ,QAAQ,EAAE,IAAI;AACtB,QAAQ,kBAAkB,EAAE,OAAO,EAAE,kBAAkB;AACvD,KAAK,CAAC;AACN;;"}
@@ -3,11 +3,12 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.cognitoIdentityIdProvider = void 0;
6
+ exports.cognitoIdentityIdProvider = cognitoIdentityIdProvider;
7
7
  const core_1 = require("@aws-amplify/core");
8
8
  const AuthError_1 = require("../../../errors/AuthError");
9
9
  const assertServiceError_1 = require("../../../errors/utils/assertServiceError");
10
10
  const parsers_1 = require("../../../foundation/parsers");
11
+ const factories_1 = require("../factories");
11
12
  const utils_1 = require("./utils");
12
13
  /**
13
14
  * Provides a Cognito identityId
@@ -36,16 +37,20 @@ async function cognitoIdentityIdProvider({ tokens, authConfig, identityIdStore,
36
37
  });
37
38
  return generatedIdentityId;
38
39
  }
39
- exports.cognitoIdentityIdProvider = cognitoIdentityIdProvider;
40
40
  async function generateIdentityId(logins, authConfig) {
41
41
  const identityPoolId = authConfig?.identityPoolId;
42
42
  const region = (0, parsers_1.getRegionFromIdentityPoolId)(identityPoolId);
43
+ const getId = (0, core_1.createGetIdClient)({
44
+ endpointResolver: (0, factories_1.createCognitoIdentityPoolEndpointResolver)({
45
+ endpointOverride: authConfig.identityPoolEndpoint,
46
+ }),
47
+ });
43
48
  // IdentityId is absent so get it using IdentityPoolId with Cognito's GetId API
44
49
  let idResult;
45
50
  // for a first-time user, this will return a brand new identity
46
51
  // for a returning user, this will retrieve the previous identity assocaited with the logins
47
52
  try {
48
- idResult = (await (0, core_1.getId)({
53
+ idResult = (await getId({
49
54
  region,
50
55
  }, {
51
56
  IdentityPoolId: identityPoolId,
@@ -1 +1 @@
1
- {"version":3,"file":"IdentityIdProvider.js","sources":["../../../../../src/providers/cognito/credentialsProvider/IdentityIdProvider.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cognitoIdentityIdProvider = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst utils_1 = require(\"./utils\");\n/**\n * Provides a Cognito identityId\n *\n * @param tokens - The AuthTokens received after SignIn\n * @returns string\n * @throws configuration exceptions: `InvalidIdentityPoolIdException`\n * - Auth errors that may arise from misconfiguration.\n * @throws service exceptions: {@link GetIdException }\n */\nasync function cognitoIdentityIdProvider({ tokens, authConfig, identityIdStore, }) {\n identityIdStore.setAuthConfig({ Cognito: authConfig });\n // will return null only if there is no identityId cached or if there is an error retrieving it\n const identityId = await identityIdStore.loadIdentityId();\n if (identityId) {\n return identityId.id;\n }\n const logins = tokens?.idToken\n ? (0, utils_1.formLoginsMap)(tokens.idToken.toString())\n : {};\n const generatedIdentityId = await generateIdentityId(logins, authConfig);\n // Store generated identityId\n identityIdStore.storeIdentityId({\n id: generatedIdentityId,\n type: tokens ? 'primary' : 'guest',\n });\n return generatedIdentityId;\n}\nexports.cognitoIdentityIdProvider = cognitoIdentityIdProvider;\nasync function generateIdentityId(logins, authConfig) {\n const identityPoolId = authConfig?.identityPoolId;\n const region = (0, parsers_1.getRegionFromIdentityPoolId)(identityPoolId);\n // IdentityId is absent so get it using IdentityPoolId with Cognito's GetId API\n let idResult;\n // for a first-time user, this will return a brand new identity\n // for a returning user, this will retrieve the previous identity assocaited with the logins\n try {\n idResult = (await (0, core_1.getId)({\n region,\n }, {\n IdentityPoolId: identityPoolId,\n Logins: logins,\n })).IdentityId;\n }\n catch (e) {\n (0, assertServiceError_1.assertServiceError)(e);\n throw new AuthError_1.AuthError(e);\n }\n if (!idResult) {\n throw new AuthError_1.AuthError({\n name: 'GetIdResponseException',\n message: 'Received undefined response from getId operation',\n recoverySuggestion: 'Make sure to pass a valid identityPoolId in the configuration.',\n });\n }\n return idResult;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,yBAAyB,GAAG,MAAM;AAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAChF,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,EAAE;AACnF,IAAI,eAAe,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAC1D;AACA,IAAI,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,cAAc,EAAE;AAC7D,IAAI,IAAI,UAAU,EAAE;AACpB,QAAQ,OAAO,UAAU,CAAC,EAAE;AAC5B;AACA,IAAI,MAAM,M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AACV;AACA,IAAI,OAAO,QAAQ;AACnB;;"}
1
+ {"version":3,"file":"IdentityIdProvider.js","sources":["../../../../../src/providers/cognito/credentialsProvider/IdentityIdProvider.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cognitoIdentityIdProvider = cognitoIdentityIdProvider;\nconst core_1 = require(\"@aws-amplify/core\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst factories_1 = require(\"../factories\");\nconst utils_1 = require(\"./utils\");\n/**\n * Provides a Cognito identityId\n *\n * @param tokens - The AuthTokens received after SignIn\n * @returns string\n * @throws configuration exceptions: `InvalidIdentityPoolIdException`\n * - Auth errors that may arise from misconfiguration.\n * @throws service exceptions: {@link GetIdException }\n */\nasync function cognitoIdentityIdProvider({ tokens, authConfig, identityIdStore, }) {\n identityIdStore.setAuthConfig({ Cognito: authConfig });\n // will return null only if there is no identityId cached or if there is an error retrieving it\n const identityId = await identityIdStore.loadIdentityId();\n if (identityId) {\n return identityId.id;\n }\n const logins = tokens?.idToken\n ? (0, utils_1.formLoginsMap)(tokens.idToken.toString())\n : {};\n const generatedIdentityId = await generateIdentityId(logins, authConfig);\n // Store generated identityId\n identityIdStore.storeIdentityId({\n id: generatedIdentityId,\n type: tokens ? 'primary' : 'guest',\n });\n return generatedIdentityId;\n}\nasync function generateIdentityId(logins, authConfig) {\n const identityPoolId = authConfig?.identityPoolId;\n const region = (0, parsers_1.getRegionFromIdentityPoolId)(identityPoolId);\n const getId = (0, core_1.createGetIdClient)({\n endpointResolver: (0, factories_1.createCognitoIdentityPoolEndpointResolver)({\n endpointOverride: authConfig.identityPoolEndpoint,\n }),\n });\n // IdentityId is absent so get it using IdentityPoolId with Cognito's GetId API\n let idResult;\n // for a first-time user, this will return a brand new identity\n // for a returning user, this will retrieve the previous identity assocaited with the logins\n try {\n idResult = (await getId({\n region,\n }, {\n IdentityPoolId: identityPoolId,\n Logins: logins,\n })).IdentityId;\n }\n catch (e) {\n (0, assertServiceError_1.assertServiceError)(e);\n throw new AuthError_1.AuthError(e);\n }\n if (!idResult) {\n throw new AuthError_1.AuthError({\n name: 'GetIdResponseException',\n message: 'Received undefined response from getId operation',\n recoverySuggestion: 'Make sure to pass a valid identityPoolId in the configuration.',\n });\n }\n return idResult;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,yBAAyB,GAAG,yBAAyB;AAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAChF,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,EAAE;AACnF,IAAI,eAAe,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAC1D;AACA,IAAI,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,cAAc,EAAE;AAC7D,IAAI,IAAI,UAAU,EAAE;AACpB,QAAQ,OAAO,UAAU,CAAC,EAAE;AAC5B;AACA,IAAI,MAAM,MAAM,GAAG,MAAM,EAAE;AAC3B,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,Q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