@drmhse/authos-vue 0.2.1 → 0.2.3
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.
- package/README.md +2 -0
- package/dist/{chokidar-KYB2GOYG.mjs → chokidar-B7NTEAA6.mjs} +1 -1
- package/dist/{chunk-C2J6NSID.mjs → chunk-CD2MZG7D.mjs} +1 -1
- package/dist/{chunk-VCTSSS2F.mjs → chunk-EI6D7ZL6.mjs} +2 -2
- package/dist/{chunk-F6BPUSH3.mjs → chunk-EO7XHAPG.mjs} +2 -2
- package/dist/{chunk-Z2UOP6GF.mjs → chunk-EX36KPG5.mjs} +2 -2
- package/dist/{chunk-SW2YRXFK.mjs → chunk-F4XRLJHQ.mjs} +2 -2
- package/dist/{chunk-XLWXQZHO.mjs → chunk-HVM6PT6I.mjs} +5 -5
- package/dist/{chunk-JLL4L3HM.mjs → chunk-N667TIER.mjs} +1 -1
- package/dist/{chunk-QGSFJDIC.mjs → chunk-XP4GDQVV.mjs} +3 -3
- package/dist/{chunk-T2K7EIWY.mjs → chunk-ZHH4WLMR.mjs} +2 -2
- package/dist/{dist-CX347IU5.mjs → dist-C3JS2B76.mjs} +14 -14
- package/dist/dist-N5W7B4HY.mjs +3 -0
- package/dist/index.d.mts +39 -5
- package/dist/index.d.ts +39 -5
- package/dist/index.js +231 -131
- package/dist/index.mjs +231 -131
- package/dist/{json5-WAUASGCX.mjs → json5-JAQYEGVI.mjs} +2 -2
- package/dist/jsonc-UUIPUC5H.mjs +3 -0
- package/dist/{multipart-parser-ZINPIK62.mjs → multipart-parser-SFUPTK6X.mjs} +5 -5
- package/dist/nuxt.js +122 -122
- package/dist/nuxt.mjs +113 -113
- package/dist/toml-VZVKMGHP.mjs +3 -0
- package/dist/{utils-ITGQWSRY.mjs → utils-YSWQHENC.mjs} +3 -3
- package/dist/yaml-G5PP6BGH.mjs +3 -0
- package/package.json +2 -2
- package/dist/dist-KTGFCHLE.mjs +0 -3
- package/dist/jsonc-BXVTKCPI.mjs +0 -3
- package/dist/toml-EIVFNDS7.mjs +0 -3
- package/dist/yaml-NCROZBG5.mjs +0 -3
- /package/dist/{prompt-LQK3IVQK.mjs → prompt-WWTBWNTY.mjs} +0 -0
package/dist/index.js
CHANGED
|
@@ -92,23 +92,38 @@ var AUTHOS_STYLES = `
|
|
|
92
92
|
Base Form Styles
|
|
93
93
|
========================================================================== */
|
|
94
94
|
|
|
95
|
+
/* ==========================================================================
|
|
96
|
+
Base Form Styles (Card Layout)
|
|
97
|
+
========================================================================== */
|
|
98
|
+
|
|
95
99
|
[data-authos-signin],
|
|
96
100
|
[data-authos-signup],
|
|
97
|
-
[data-authos-
|
|
101
|
+
[data-authos-magic-link],
|
|
98
102
|
[data-authos-passkey] {
|
|
99
103
|
font-family: var(--authos-font-family);
|
|
100
104
|
font-size: var(--authos-font-size-sm);
|
|
101
105
|
color: var(--authos-color-foreground);
|
|
106
|
+
|
|
107
|
+
/* Card Styling */
|
|
108
|
+
background-color: var(--authos-color-surface);
|
|
109
|
+
border: 1px solid var(--authos-color-border);
|
|
110
|
+
border-radius: var(--authos-border-radius-lg);
|
|
111
|
+
box-shadow: var(--authos-shadow);
|
|
112
|
+
padding: 2rem;
|
|
102
113
|
width: 100%;
|
|
114
|
+
max-width: 25rem; /* 400px */
|
|
115
|
+
margin: 0 auto; /* Center horizontally */
|
|
103
116
|
}
|
|
104
117
|
|
|
118
|
+
/* Ensure forms inside take full width */
|
|
105
119
|
[data-authos-signin] form,
|
|
106
120
|
[data-authos-signup] form,
|
|
107
|
-
[data-authos-
|
|
121
|
+
[data-authos-magic-link] form,
|
|
108
122
|
[data-authos-passkey] form {
|
|
109
123
|
display: flex;
|
|
110
124
|
flex-direction: column;
|
|
111
125
|
gap: var(--authos-spacing-md);
|
|
126
|
+
width: 100%;
|
|
112
127
|
}
|
|
113
128
|
|
|
114
129
|
/* ==========================================================================
|
|
@@ -486,6 +501,16 @@ function createAuthOS(options) {
|
|
|
486
501
|
if (options.appearance?.variables) {
|
|
487
502
|
applyVariables(options.appearance.variables);
|
|
488
503
|
}
|
|
504
|
+
if (options.org && !options.service) {
|
|
505
|
+
console.warn(
|
|
506
|
+
'[AuthOS] You provided "org" but not "service". OAuth flows may not work correctly.'
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
if (!options.org && options.service) {
|
|
510
|
+
console.warn(
|
|
511
|
+
'[AuthOS] You provided "service" but not "org". OAuth flows may not work correctly.'
|
|
512
|
+
);
|
|
513
|
+
}
|
|
489
514
|
vue.nextTick(() => {
|
|
490
515
|
setInitialToken();
|
|
491
516
|
});
|
|
@@ -857,6 +882,133 @@ var SignIn = vue.defineComponent({
|
|
|
857
882
|
};
|
|
858
883
|
}
|
|
859
884
|
});
|
|
885
|
+
var PROVIDER_NAMES = {
|
|
886
|
+
github: "GitHub",
|
|
887
|
+
google: "Google",
|
|
888
|
+
microsoft: "Microsoft"
|
|
889
|
+
};
|
|
890
|
+
function getProviderIcon(provider) {
|
|
891
|
+
switch (provider) {
|
|
892
|
+
case "github":
|
|
893
|
+
return vue.h("svg", {
|
|
894
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
895
|
+
viewBox: "0 0 24 24",
|
|
896
|
+
fill: "currentColor",
|
|
897
|
+
"aria-hidden": "true"
|
|
898
|
+
}, [
|
|
899
|
+
vue.h("path", {
|
|
900
|
+
d: "M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"
|
|
901
|
+
})
|
|
902
|
+
]);
|
|
903
|
+
case "google":
|
|
904
|
+
return vue.h("svg", {
|
|
905
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
906
|
+
viewBox: "0 0 24 24",
|
|
907
|
+
"aria-hidden": "true"
|
|
908
|
+
}, [
|
|
909
|
+
vue.h("path", {
|
|
910
|
+
fill: "#4285F4",
|
|
911
|
+
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
912
|
+
}),
|
|
913
|
+
vue.h("path", {
|
|
914
|
+
fill: "#34A853",
|
|
915
|
+
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
916
|
+
}),
|
|
917
|
+
vue.h("path", {
|
|
918
|
+
fill: "#FBBC05",
|
|
919
|
+
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
920
|
+
}),
|
|
921
|
+
vue.h("path", {
|
|
922
|
+
fill: "#EA4335",
|
|
923
|
+
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
924
|
+
})
|
|
925
|
+
]);
|
|
926
|
+
case "microsoft":
|
|
927
|
+
return vue.h("svg", {
|
|
928
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
929
|
+
viewBox: "0 0 23 23",
|
|
930
|
+
"aria-hidden": "true"
|
|
931
|
+
}, [
|
|
932
|
+
vue.h("path", { fill: "#f35325", d: "M1 1h10v10H1z" }),
|
|
933
|
+
vue.h("path", { fill: "#81bc06", d: "M12 1h10v10H12z" }),
|
|
934
|
+
vue.h("path", { fill: "#05a6f0", d: "M1 12h10v10H1z" }),
|
|
935
|
+
vue.h("path", { fill: "#ffba08", d: "M12 12h10v10H12z" })
|
|
936
|
+
]);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
var OAuthButton = vue.defineComponent({
|
|
940
|
+
name: "OAuthButton",
|
|
941
|
+
props: {
|
|
942
|
+
provider: {
|
|
943
|
+
type: String,
|
|
944
|
+
required: true
|
|
945
|
+
},
|
|
946
|
+
disabled: {
|
|
947
|
+
type: Boolean,
|
|
948
|
+
default: false
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
emits: ["redirect"],
|
|
952
|
+
setup(props, { slots, emit }) {
|
|
953
|
+
const { client, options } = useAuthOS();
|
|
954
|
+
const isConfigured = vue.computed(() => !!(options.org && options.service));
|
|
955
|
+
const providerName = vue.computed(() => PROVIDER_NAMES[props.provider]);
|
|
956
|
+
function handleClick() {
|
|
957
|
+
if (!options.org || !options.service) {
|
|
958
|
+
console.error(
|
|
959
|
+
`[AuthOS] OAuth login requires "org" and "service" in createAuthOS options.
|
|
960
|
+
Current options: { org: ${options.org ? `"${options.org}"` : "undefined"}, service: ${options.service ? `"${options.service}"` : "undefined"} }
|
|
961
|
+
|
|
962
|
+
Example:
|
|
963
|
+
app.use(createAuthOS({
|
|
964
|
+
baseURL: "${options.baseURL}",
|
|
965
|
+
org: "your-org-slug",
|
|
966
|
+
service: "your-service-slug",
|
|
967
|
+
}));
|
|
968
|
+
|
|
969
|
+
See: https://docs.authos.dev/vue/oauth-setup`
|
|
970
|
+
);
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
const redirectUri = options.redirectUri ?? (typeof window !== "undefined" ? window.location.origin + "/callback" : void 0);
|
|
974
|
+
const url = client.auth.getLoginUrl(props.provider, {
|
|
975
|
+
org: options.org,
|
|
976
|
+
service: options.service,
|
|
977
|
+
redirect_uri: redirectUri
|
|
978
|
+
});
|
|
979
|
+
emit("redirect");
|
|
980
|
+
window.location.href = url;
|
|
981
|
+
}
|
|
982
|
+
return () => {
|
|
983
|
+
const slotProps = {
|
|
984
|
+
provider: props.provider,
|
|
985
|
+
providerName: providerName.value,
|
|
986
|
+
isConfigured: isConfigured.value,
|
|
987
|
+
disabled: props.disabled,
|
|
988
|
+
handleClick
|
|
989
|
+
};
|
|
990
|
+
if (slots.default) {
|
|
991
|
+
return slots.default(slotProps);
|
|
992
|
+
}
|
|
993
|
+
return vue.h(
|
|
994
|
+
"button",
|
|
995
|
+
{
|
|
996
|
+
type: "button",
|
|
997
|
+
onClick: handleClick,
|
|
998
|
+
disabled: props.disabled || !isConfigured.value,
|
|
999
|
+
"data-authos-oauth": "",
|
|
1000
|
+
"data-provider": props.provider
|
|
1001
|
+
},
|
|
1002
|
+
[
|
|
1003
|
+
getProviderIcon(props.provider),
|
|
1004
|
+
vue.h("span", `Continue with ${providerName.value}`)
|
|
1005
|
+
]
|
|
1006
|
+
);
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
|
|
1011
|
+
// src/components/SignUp.ts
|
|
860
1012
|
var SignUp = vue.defineComponent({
|
|
861
1013
|
name: "SignUp",
|
|
862
1014
|
props: {
|
|
@@ -877,25 +1029,53 @@ var SignUp = vue.defineComponent({
|
|
|
877
1029
|
serviceSlug: {
|
|
878
1030
|
type: String,
|
|
879
1031
|
default: void 0
|
|
1032
|
+
},
|
|
1033
|
+
/** List of OAuth providers to display buttons for */
|
|
1034
|
+
providers: {
|
|
1035
|
+
type: [Array, Boolean],
|
|
1036
|
+
default: false
|
|
1037
|
+
},
|
|
1038
|
+
/** Show divider between OAuth and email form */
|
|
1039
|
+
showDivider: {
|
|
1040
|
+
type: Boolean,
|
|
1041
|
+
default: true
|
|
1042
|
+
},
|
|
1043
|
+
/** Show sign in link */
|
|
1044
|
+
showSignIn: {
|
|
1045
|
+
type: Boolean,
|
|
1046
|
+
default: true
|
|
880
1047
|
}
|
|
881
1048
|
},
|
|
882
1049
|
emits: ["success", "error"],
|
|
883
1050
|
setup(props, { slots, emit }) {
|
|
884
|
-
const { client } = useAuthOS();
|
|
1051
|
+
const { client, options } = useAuthOS();
|
|
885
1052
|
const email = vue.ref("");
|
|
886
1053
|
const password = vue.ref("");
|
|
1054
|
+
const confirmPassword = vue.ref("");
|
|
887
1055
|
const error = vue.ref(null);
|
|
888
1056
|
const isSubmitting = vue.ref(false);
|
|
1057
|
+
const isSuccess = vue.ref(false);
|
|
1058
|
+
const hasOAuthConfig = !!(options.org && options.service);
|
|
1059
|
+
const oauthProviders = Array.isArray(props.providers) ? props.providers : [];
|
|
889
1060
|
async function submit() {
|
|
890
1061
|
error.value = null;
|
|
1062
|
+
if (password.value !== confirmPassword.value) {
|
|
1063
|
+
error.value = "Passwords do not match";
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
if (password.value.length < 8) {
|
|
1067
|
+
error.value = "Password must be at least 8 characters";
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
891
1070
|
isSubmitting.value = true;
|
|
892
1071
|
try {
|
|
893
1072
|
await client.auth.register({
|
|
894
1073
|
email: email.value,
|
|
895
1074
|
password: password.value,
|
|
896
|
-
org_slug: props.orgSlug,
|
|
897
|
-
service_slug: props.serviceSlug
|
|
1075
|
+
org_slug: props.orgSlug ?? options.org,
|
|
1076
|
+
service_slug: props.serviceSlug ?? options.service
|
|
898
1077
|
});
|
|
1078
|
+
isSuccess.value = true;
|
|
899
1079
|
emit("success");
|
|
900
1080
|
props.onSuccess?.();
|
|
901
1081
|
} catch (err) {
|
|
@@ -921,7 +1101,33 @@ var SignUp = vue.defineComponent({
|
|
|
921
1101
|
if (slots.default) {
|
|
922
1102
|
return slots.default(slotProps);
|
|
923
1103
|
}
|
|
1104
|
+
if (isSuccess.value) {
|
|
1105
|
+
return vue.h("div", { "data-authos-signup": "", "data-state": "success" }, [
|
|
1106
|
+
vue.h("div", { "data-authos-success": "" }, [
|
|
1107
|
+
vue.h("h2", "Check your email"),
|
|
1108
|
+
vue.h("p", `We've sent a verification link to ${email.value}. Please click the link to verify your account.`)
|
|
1109
|
+
])
|
|
1110
|
+
]);
|
|
1111
|
+
}
|
|
924
1112
|
return vue.h("div", { "data-authos-signup": "", "data-state": "credentials" }, [
|
|
1113
|
+
// OAuth Section
|
|
1114
|
+
oauthProviders.length > 0 && vue.h("div", { "data-authos-oauth-section": "" }, [
|
|
1115
|
+
oauthProviders.map(
|
|
1116
|
+
(provider) => vue.h(OAuthButton, {
|
|
1117
|
+
key: provider,
|
|
1118
|
+
provider,
|
|
1119
|
+
disabled: isSubmitting.value || !hasOAuthConfig
|
|
1120
|
+
})
|
|
1121
|
+
),
|
|
1122
|
+
!hasOAuthConfig && vue.h("p", {
|
|
1123
|
+
"data-authos-oauth-warning": "",
|
|
1124
|
+
style: { color: "orange", fontSize: "0.875rem" }
|
|
1125
|
+
}, "OAuth requires org and service in plugin options")
|
|
1126
|
+
]),
|
|
1127
|
+
// Divider
|
|
1128
|
+
oauthProviders.length > 0 && props.showDivider && vue.h("div", { "data-authos-divider": "" }, [
|
|
1129
|
+
vue.h("span", "or")
|
|
1130
|
+
]),
|
|
925
1131
|
vue.h("form", { onSubmit: (e) => {
|
|
926
1132
|
e.preventDefault();
|
|
927
1133
|
submit();
|
|
@@ -952,12 +1158,31 @@ var SignUp = vue.defineComponent({
|
|
|
952
1158
|
onInput: (e) => password.value = e.target.value
|
|
953
1159
|
})
|
|
954
1160
|
]),
|
|
1161
|
+
// Confirm Password
|
|
1162
|
+
vue.h("div", { "data-authos-field": "confirm-password" }, [
|
|
1163
|
+
vue.h("label", { for: "authos-signup-confirm" }, "Confirm Password"),
|
|
1164
|
+
vue.h("input", {
|
|
1165
|
+
id: "authos-signup-confirm",
|
|
1166
|
+
type: "password",
|
|
1167
|
+
autocomplete: "new-password",
|
|
1168
|
+
value: confirmPassword.value,
|
|
1169
|
+
placeholder: "Confirm your password",
|
|
1170
|
+
required: true,
|
|
1171
|
+
disabled: isSubmitting.value,
|
|
1172
|
+
onInput: (e) => confirmPassword.value = e.target.value
|
|
1173
|
+
})
|
|
1174
|
+
]),
|
|
955
1175
|
error.value && vue.h("div", { "data-authos-error": "" }, error.value),
|
|
956
1176
|
vue.h("button", {
|
|
957
1177
|
type: "submit",
|
|
958
1178
|
disabled: isSubmitting.value,
|
|
959
1179
|
"data-authos-submit": ""
|
|
960
|
-
}, isSubmitting.value ? "Creating account..." : "Sign Up")
|
|
1180
|
+
}, isSubmitting.value ? "Creating account..." : "Sign Up"),
|
|
1181
|
+
// Sign In Link
|
|
1182
|
+
props.showSignIn && vue.h("div", { "data-authos-signin-prompt": "" }, [
|
|
1183
|
+
"Already have an account? ",
|
|
1184
|
+
vue.h("a", { href: "/signin", "data-authos-link": "signin" }, "Sign in")
|
|
1185
|
+
])
|
|
961
1186
|
])
|
|
962
1187
|
]);
|
|
963
1188
|
};
|
|
@@ -1125,131 +1350,6 @@ var Protect = vue.defineComponent({
|
|
|
1125
1350
|
};
|
|
1126
1351
|
}
|
|
1127
1352
|
});
|
|
1128
|
-
var PROVIDER_NAMES = {
|
|
1129
|
-
github: "GitHub",
|
|
1130
|
-
google: "Google",
|
|
1131
|
-
microsoft: "Microsoft"
|
|
1132
|
-
};
|
|
1133
|
-
function getProviderIcon(provider) {
|
|
1134
|
-
switch (provider) {
|
|
1135
|
-
case "github":
|
|
1136
|
-
return vue.h("svg", {
|
|
1137
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1138
|
-
viewBox: "0 0 24 24",
|
|
1139
|
-
fill: "currentColor",
|
|
1140
|
-
"aria-hidden": "true"
|
|
1141
|
-
}, [
|
|
1142
|
-
vue.h("path", {
|
|
1143
|
-
d: "M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"
|
|
1144
|
-
})
|
|
1145
|
-
]);
|
|
1146
|
-
case "google":
|
|
1147
|
-
return vue.h("svg", {
|
|
1148
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1149
|
-
viewBox: "0 0 24 24",
|
|
1150
|
-
"aria-hidden": "true"
|
|
1151
|
-
}, [
|
|
1152
|
-
vue.h("path", {
|
|
1153
|
-
fill: "#4285F4",
|
|
1154
|
-
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
1155
|
-
}),
|
|
1156
|
-
vue.h("path", {
|
|
1157
|
-
fill: "#34A853",
|
|
1158
|
-
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
1159
|
-
}),
|
|
1160
|
-
vue.h("path", {
|
|
1161
|
-
fill: "#FBBC05",
|
|
1162
|
-
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
1163
|
-
}),
|
|
1164
|
-
vue.h("path", {
|
|
1165
|
-
fill: "#EA4335",
|
|
1166
|
-
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
1167
|
-
})
|
|
1168
|
-
]);
|
|
1169
|
-
case "microsoft":
|
|
1170
|
-
return vue.h("svg", {
|
|
1171
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1172
|
-
viewBox: "0 0 23 23",
|
|
1173
|
-
"aria-hidden": "true"
|
|
1174
|
-
}, [
|
|
1175
|
-
vue.h("path", { fill: "#f35325", d: "M1 1h10v10H1z" }),
|
|
1176
|
-
vue.h("path", { fill: "#81bc06", d: "M12 1h10v10H12z" }),
|
|
1177
|
-
vue.h("path", { fill: "#05a6f0", d: "M1 12h10v10H1z" }),
|
|
1178
|
-
vue.h("path", { fill: "#ffba08", d: "M12 12h10v10H12z" })
|
|
1179
|
-
]);
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
var OAuthButton = vue.defineComponent({
|
|
1183
|
-
name: "OAuthButton",
|
|
1184
|
-
props: {
|
|
1185
|
-
provider: {
|
|
1186
|
-
type: String,
|
|
1187
|
-
required: true
|
|
1188
|
-
},
|
|
1189
|
-
disabled: {
|
|
1190
|
-
type: Boolean,
|
|
1191
|
-
default: false
|
|
1192
|
-
}
|
|
1193
|
-
},
|
|
1194
|
-
emits: ["redirect"],
|
|
1195
|
-
setup(props, { slots, emit }) {
|
|
1196
|
-
const { client, options } = useAuthOS();
|
|
1197
|
-
const isConfigured = vue.computed(() => !!(options.org && options.service));
|
|
1198
|
-
const providerName = vue.computed(() => PROVIDER_NAMES[props.provider]);
|
|
1199
|
-
function handleClick() {
|
|
1200
|
-
if (!options.org || !options.service) {
|
|
1201
|
-
console.error(
|
|
1202
|
-
`[AuthOS] OAuth login requires "org" and "service" in createAuthOS options.
|
|
1203
|
-
Current options: { org: ${options.org ? `"${options.org}"` : "undefined"}, service: ${options.service ? `"${options.service}"` : "undefined"} }
|
|
1204
|
-
|
|
1205
|
-
Example:
|
|
1206
|
-
app.use(createAuthOS({
|
|
1207
|
-
baseURL: "${options.baseURL}",
|
|
1208
|
-
org: "your-org-slug",
|
|
1209
|
-
service: "your-service-slug",
|
|
1210
|
-
}));
|
|
1211
|
-
|
|
1212
|
-
See: https://docs.authos.dev/vue/oauth-setup`
|
|
1213
|
-
);
|
|
1214
|
-
return;
|
|
1215
|
-
}
|
|
1216
|
-
const redirectUri = options.redirectUri ?? (typeof window !== "undefined" ? window.location.origin + "/callback" : void 0);
|
|
1217
|
-
const url = client.auth.getLoginUrl(props.provider, {
|
|
1218
|
-
org: options.org,
|
|
1219
|
-
service: options.service,
|
|
1220
|
-
redirect_uri: redirectUri
|
|
1221
|
-
});
|
|
1222
|
-
emit("redirect");
|
|
1223
|
-
window.location.href = url;
|
|
1224
|
-
}
|
|
1225
|
-
return () => {
|
|
1226
|
-
const slotProps = {
|
|
1227
|
-
provider: props.provider,
|
|
1228
|
-
providerName: providerName.value,
|
|
1229
|
-
isConfigured: isConfigured.value,
|
|
1230
|
-
disabled: props.disabled,
|
|
1231
|
-
handleClick
|
|
1232
|
-
};
|
|
1233
|
-
if (slots.default) {
|
|
1234
|
-
return slots.default(slotProps);
|
|
1235
|
-
}
|
|
1236
|
-
return vue.h(
|
|
1237
|
-
"button",
|
|
1238
|
-
{
|
|
1239
|
-
type: "button",
|
|
1240
|
-
onClick: handleClick,
|
|
1241
|
-
disabled: props.disabled || !isConfigured.value,
|
|
1242
|
-
"data-authos-oauth": "",
|
|
1243
|
-
"data-provider": props.provider
|
|
1244
|
-
},
|
|
1245
|
-
[
|
|
1246
|
-
getProviderIcon(props.provider),
|
|
1247
|
-
vue.h("span", `Continue with ${providerName.value}`)
|
|
1248
|
-
]
|
|
1249
|
-
);
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
});
|
|
1253
1353
|
var SignedIn = vue.defineComponent({
|
|
1254
1354
|
name: "SignedIn",
|
|
1255
1355
|
setup(_, { slots }) {
|