UNPKG

2.59 kBJavaScriptView Raw
1/*
2 * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5 * the License. A copy of the License is located at
6 *
7 * http://aws.amazon.com/apache2.0/
8 *
9 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11 * and limitations under the License.
12 */
13export var CognitoHostedUIIdentityProvider;
14(function (CognitoHostedUIIdentityProvider) {
15 CognitoHostedUIIdentityProvider["Cognito"] = "COGNITO";
16 CognitoHostedUIIdentityProvider["Google"] = "Google";
17 CognitoHostedUIIdentityProvider["Facebook"] = "Facebook";
18 CognitoHostedUIIdentityProvider["Amazon"] = "LoginWithAmazon";
19 CognitoHostedUIIdentityProvider["Apple"] = "SignInWithApple";
20})(CognitoHostedUIIdentityProvider || (CognitoHostedUIIdentityProvider = {}));
21export function isFederatedSignInOptions(obj) {
22 var keys = ['provider'];
23 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
24}
25export function isFederatedSignInOptionsCustom(obj) {
26 var keys = ['customProvider'];
27 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
28}
29export function hasCustomState(obj) {
30 var keys = ['customState'];
31 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
32}
33export function isCognitoHostedOpts(oauth) {
34 return oauth.redirectSignIn !== undefined;
35}
36export var AuthErrorTypes;
37(function (AuthErrorTypes) {
38 AuthErrorTypes["NoConfig"] = "noConfig";
39 AuthErrorTypes["MissingAuthConfig"] = "missingAuthConfig";
40 AuthErrorTypes["EmptyUsername"] = "emptyUsername";
41 AuthErrorTypes["InvalidUsername"] = "invalidUsername";
42 AuthErrorTypes["EmptyPassword"] = "emptyPassword";
43 AuthErrorTypes["EmptyCode"] = "emptyCode";
44 AuthErrorTypes["SignUpError"] = "signUpError";
45 AuthErrorTypes["NoMFA"] = "noMFA";
46 AuthErrorTypes["InvalidMFA"] = "invalidMFA";
47 AuthErrorTypes["EmptyChallengeResponse"] = "emptyChallengeResponse";
48 AuthErrorTypes["NoUserSession"] = "noUserSession";
49 AuthErrorTypes["Default"] = "default";
50 AuthErrorTypes["DeviceConfig"] = "deviceConfig";
51 AuthErrorTypes["NetworkError"] = "networkError";
52})(AuthErrorTypes || (AuthErrorTypes = {}));
53export function isUsernamePasswordOpts(obj) {
54 return !!obj.username;
55}
56//# sourceMappingURL=Auth.js.map
\No newline at end of file