@drmhse/authos-vue 0.2.2 → 0.2.4
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 +31 -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 +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +84 -2
- package/dist/index.mjs +84 -3
- 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 +4 -3
- 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/README.md
CHANGED
|
@@ -250,6 +250,37 @@ Individual OAuth provider button. Requires `org` and `service` in plugin options
|
|
|
250
250
|
</OAuthButton>
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
+
### Callback
|
|
254
|
+
|
|
255
|
+
Required for OAuth flows. Handles the redirect from the identity provider by parsing tokens from the URL fragment and setting the session.
|
|
256
|
+
|
|
257
|
+
```vue
|
|
258
|
+
<script setup>
|
|
259
|
+
import { Callback } from '@drmhse/authos-vue';
|
|
260
|
+
import { useRouter } from 'vue-router';
|
|
261
|
+
|
|
262
|
+
const router = useRouter();
|
|
263
|
+
|
|
264
|
+
function handleSuccess() {
|
|
265
|
+
router.push('/');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function handleError(error) {
|
|
269
|
+
console.error('Login failed:', error);
|
|
270
|
+
}
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<template>
|
|
274
|
+
<Callback @success="handleSuccess" @error="handleError" />
|
|
275
|
+
</template>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Events:**
|
|
279
|
+
| Event | Payload | Description |
|
|
280
|
+
|-------|---------|-------------|
|
|
281
|
+
| `@success` | - | Fired after session is successfully set |
|
|
282
|
+
| `@error` | `Error` | Fired on error |
|
|
283
|
+
|
|
253
284
|
## Composables
|
|
254
285
|
|
|
255
286
|
### useAuthOS
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N, C } from './chunk-
|
|
1
|
+
import { N, C } from './chunk-N667TIER.mjs';
|
|
2
2
|
|
|
3
|
-
// node_modules/confbox/dist/json5.mjs
|
|
3
|
+
// ../../node_modules/confbox/dist/json5.mjs
|
|
4
4
|
function R(C2) {
|
|
5
5
|
return C2 && C2.__esModule && Object.prototype.hasOwnProperty.call(C2, "default") ? C2.default : C2;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N, C } from './chunk-
|
|
1
|
+
import { N, C } from './chunk-N667TIER.mjs';
|
|
2
2
|
|
|
3
|
-
// node_modules/confbox/dist/toml.mjs
|
|
3
|
+
// ../../node_modules/confbox/dist/toml.mjs
|
|
4
4
|
function v(e, n) {
|
|
5
5
|
let t = e.slice(0, n).split(/\r\n|\n|\r/g);
|
|
6
6
|
return [t.length, t.pop().length + 1];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N, C } from './chunk-
|
|
1
|
+
import { N, C } from './chunk-N667TIER.mjs';
|
|
2
2
|
|
|
3
|
-
// node_modules/confbox/dist/shared/confbox.DnMsyigM.mjs
|
|
3
|
+
// ../../node_modules/confbox/dist/shared/confbox.DnMsyigM.mjs
|
|
4
4
|
function $(n, l = false) {
|
|
5
5
|
const g = n.length;
|
|
6
6
|
let e = 0, u = "", p = 0, k = 16, A = 0, o = 0, O = 0, B = 0, b = 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __commonJS, __require } from './chunk-6DZX6EAA.mjs';
|
|
2
2
|
|
|
3
|
-
// node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs
|
|
3
|
+
// ../../node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs
|
|
4
4
|
var require_node_fetch_native_DhEqb06g = __commonJS({
|
|
5
|
-
"node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs"(exports$1) {
|
|
5
|
+
"../../node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs"(exports$1) {
|
|
6
6
|
var l = Object.defineProperty;
|
|
7
7
|
var o = (e, t) => l(e, "name", { value: t, configurable: true });
|
|
8
8
|
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
@@ -13,9 +13,9 @@ var require_node_fetch_native_DhEqb06g = __commonJS({
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
// node_modules/node-fetch-native/dist/node.cjs
|
|
16
|
+
// ../../node_modules/node-fetch-native/dist/node.cjs
|
|
17
17
|
var require_node = __commonJS({
|
|
18
|
-
"node_modules/node-fetch-native/dist/node.cjs"(exports$1) {
|
|
18
|
+
"../../node_modules/node-fetch-native/dist/node.cjs"(exports$1) {
|
|
19
19
|
var ys = Object.defineProperty;
|
|
20
20
|
var Po = (c) => {
|
|
21
21
|
throw TypeError(c);
|
|
@@ -2736,7 +2736,7 @@ Content-Type: ${R.type || "application/octet-stream"}\r
|
|
|
2736
2736
|
for (const [R, w] of b) g.append(R, w);
|
|
2737
2737
|
return g;
|
|
2738
2738
|
}
|
|
2739
|
-
const { toFormData: d } = await import('./multipart-parser-
|
|
2739
|
+
const { toFormData: d } = await import('./multipart-parser-SFUPTK6X.mjs');
|
|
2740
2740
|
return d(this.body, l);
|
|
2741
2741
|
}
|
|
2742
2742
|
async blob() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { x, h } from './chunk-
|
|
1
|
+
import { x, h } from './chunk-F4XRLJHQ.mjs';
|
|
2
2
|
import fs, { promises, lstatSync, realpathSync, statSync } from 'fs';
|
|
3
3
|
import { fileURLToPath, pathToFileURL, URL as URL$1 } from 'url';
|
|
4
4
|
import path, { isAbsolute as isAbsolute$1 } from 'path';
|
|
@@ -8,7 +8,7 @@ import v8 from 'v8';
|
|
|
8
8
|
import { format, inspect } from 'util';
|
|
9
9
|
import 'fs/promises';
|
|
10
10
|
|
|
11
|
-
// node_modules/defu/dist/defu.mjs
|
|
11
|
+
// ../../node_modules/defu/dist/defu.mjs
|
|
12
12
|
function isPlainObject(value) {
|
|
13
13
|
if (value === null || typeof value !== "object") {
|
|
14
14
|
return false;
|
|
@@ -64,7 +64,7 @@ function createDefu(merger) {
|
|
|
64
64
|
}
|
|
65
65
|
var defu = createDefu();
|
|
66
66
|
|
|
67
|
-
// node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
67
|
+
// ../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
68
68
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
69
69
|
function normalizeWindowsPath(input = "") {
|
|
70
70
|
if (!input) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { serialize } from './chunk-
|
|
1
|
+
import { serialize } from './chunk-CD2MZG7D.mjs';
|
|
2
2
|
import { createHash } from 'crypto';
|
|
3
3
|
|
|
4
4
|
var e = globalThis.process?.getBuiltinModule?.("crypto")?.hash;
|
|
@@ -10,7 +10,7 @@ function digest(t) {
|
|
|
10
10
|
return globalThis.process?.versions?.webcontainer ? o.digest().toString(s) : o.digest(s);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
// node_modules/ohash/dist/index.mjs
|
|
13
|
+
// ../../node_modules/ohash/dist/index.mjs
|
|
14
14
|
function hash(input) {
|
|
15
15
|
return digest(serialize(input));
|
|
16
16
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { resolve, relative, defu, dirname, basename, join, normalize } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import { require_node, require_node_fetch_native_DhEqb06g } from './chunk-
|
|
1
|
+
import { resolve, relative, defu, dirname, basename, join, normalize } from './chunk-XP4GDQVV.mjs';
|
|
2
|
+
import './chunk-EI6D7ZL6.mjs';
|
|
3
|
+
import './chunk-EX36KPG5.mjs';
|
|
4
|
+
import './chunk-EO7XHAPG.mjs';
|
|
5
|
+
import './chunk-F4XRLJHQ.mjs';
|
|
6
|
+
import './chunk-N667TIER.mjs';
|
|
7
|
+
import { require_node, require_node_fetch_native_DhEqb06g } from './chunk-HVM6PT6I.mjs';
|
|
8
8
|
import { __commonJS, __require, __toESM } from './chunk-6DZX6EAA.mjs';
|
|
9
9
|
import { mkdir, rm, readFile, writeFile } from 'fs/promises';
|
|
10
10
|
import V2, { existsSync, readdirSync, renameSync, createWriteStream } from 'fs';
|
|
@@ -23,9 +23,9 @@ import { spawnSync, spawn } from 'child_process';
|
|
|
23
23
|
import c from 'readline';
|
|
24
24
|
import { homedir, tmpdir } from 'os';
|
|
25
25
|
|
|
26
|
-
// node_modules/node-fetch-native/dist/index.cjs
|
|
26
|
+
// ../../node_modules/node-fetch-native/dist/index.cjs
|
|
27
27
|
var require_dist = __commonJS({
|
|
28
|
-
"node_modules/node-fetch-native/dist/index.cjs"(exports$1) {
|
|
28
|
+
"../../node_modules/node-fetch-native/dist/index.cjs"(exports$1) {
|
|
29
29
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
30
30
|
var node = require_node();
|
|
31
31
|
__require("http"), __require("https"), __require("zlib"), __require("stream"), __require("buffer"), __require("util"), require_node_fetch_native_DhEqb06g(), __require("url"), __require("net"), __require("fs"), __require("path");
|
|
@@ -42,9 +42,9 @@ var require_dist = __commonJS({
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
// node_modules/node-fetch-native/lib/index.cjs
|
|
45
|
+
// ../../node_modules/node-fetch-native/lib/index.cjs
|
|
46
46
|
var require_lib = __commonJS({
|
|
47
|
-
"node_modules/node-fetch-native/lib/index.cjs"(exports$1, module) {
|
|
47
|
+
"../../node_modules/node-fetch-native/lib/index.cjs"(exports$1, module) {
|
|
48
48
|
var nodeFetch = require_dist();
|
|
49
49
|
function fetch2(input, options) {
|
|
50
50
|
return nodeFetch.fetch(input, options);
|
|
@@ -56,9 +56,9 @@ var require_lib = __commonJS({
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
// node_modules/node-fetch-native/dist/proxy.cjs
|
|
59
|
+
// ../../node_modules/node-fetch-native/dist/proxy.cjs
|
|
60
60
|
var require_proxy = __commonJS({
|
|
61
|
-
"node_modules/node-fetch-native/dist/proxy.cjs"(exports$1) {
|
|
61
|
+
"../../node_modules/node-fetch-native/dist/proxy.cjs"(exports$1) {
|
|
62
62
|
var Ye = Object.defineProperty;
|
|
63
63
|
var Re = (A2) => {
|
|
64
64
|
throw TypeError(A2);
|
|
@@ -10006,7 +10006,7 @@ async function installDependencies(options = {}) {
|
|
|
10006
10006
|
};
|
|
10007
10007
|
}
|
|
10008
10008
|
|
|
10009
|
-
// node_modules/giget/dist/shared/giget.OCaTp9b-.mjs
|
|
10009
|
+
// ../../node_modules/giget/dist/shared/giget.OCaTp9b-.mjs
|
|
10010
10010
|
var import_proxy = __toESM(require_proxy(), 1);
|
|
10011
10011
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
10012
10012
|
function getDefaultExportFromCjs(x2) {
|
package/dist/index.d.mts
CHANGED
|
@@ -755,4 +755,37 @@ declare const PasskeySignIn: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
755
755
|
showPasswordSignIn: boolean;
|
|
756
756
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
757
757
|
|
|
758
|
-
|
|
758
|
+
interface CallbackSlotProps {
|
|
759
|
+
error: string | null;
|
|
760
|
+
}
|
|
761
|
+
declare const Callback: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
762
|
+
onSuccess: {
|
|
763
|
+
type: PropType<() => void>;
|
|
764
|
+
default: undefined;
|
|
765
|
+
};
|
|
766
|
+
onError: {
|
|
767
|
+
type: PropType<(error: Error) => void>;
|
|
768
|
+
default: undefined;
|
|
769
|
+
};
|
|
770
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
771
|
+
[key: string]: any;
|
|
772
|
+
}> | vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
773
|
+
[key: string]: any;
|
|
774
|
+
}>[], {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("success" | "error")[], "success" | "error", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
775
|
+
onSuccess: {
|
|
776
|
+
type: PropType<() => void>;
|
|
777
|
+
default: undefined;
|
|
778
|
+
};
|
|
779
|
+
onError: {
|
|
780
|
+
type: PropType<(error: Error) => void>;
|
|
781
|
+
default: undefined;
|
|
782
|
+
};
|
|
783
|
+
}>> & Readonly<{
|
|
784
|
+
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
785
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
786
|
+
}>, {
|
|
787
|
+
onSuccess: () => void;
|
|
788
|
+
onError: (error: Error) => void;
|
|
789
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
790
|
+
|
|
791
|
+
export { AUTH_OS_INJECTION_KEY, type AppearanceOptions, type AppearanceVariables, type AuthOSContext, type AuthOSPluginOptions, AuthOSProvider, type AuthOSState, Callback, type CallbackSlotProps, MagicLinkSignIn, OAuthButton, type OAuthButtonSlotProps, OrganizationSwitcher, type OrganizationSwitcherSlotProps, PasskeySignIn, Protect, SignIn, type SignInSlotProps, SignUp, type SignUpSlotProps, SignedIn, SignedOut, type SupportedOAuthProvider$1 as SupportedOAuthProvider, UserButton, type UserButtonSlotProps, createAuthOS, useAllPermissions, useAnyPermission, useAuthOS, useOrganization, usePermission, useUser };
|
package/dist/index.d.ts
CHANGED
|
@@ -755,4 +755,37 @@ declare const PasskeySignIn: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
755
755
|
showPasswordSignIn: boolean;
|
|
756
756
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
757
757
|
|
|
758
|
-
|
|
758
|
+
interface CallbackSlotProps {
|
|
759
|
+
error: string | null;
|
|
760
|
+
}
|
|
761
|
+
declare const Callback: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
762
|
+
onSuccess: {
|
|
763
|
+
type: PropType<() => void>;
|
|
764
|
+
default: undefined;
|
|
765
|
+
};
|
|
766
|
+
onError: {
|
|
767
|
+
type: PropType<(error: Error) => void>;
|
|
768
|
+
default: undefined;
|
|
769
|
+
};
|
|
770
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
771
|
+
[key: string]: any;
|
|
772
|
+
}> | vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
773
|
+
[key: string]: any;
|
|
774
|
+
}>[], {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("success" | "error")[], "success" | "error", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
775
|
+
onSuccess: {
|
|
776
|
+
type: PropType<() => void>;
|
|
777
|
+
default: undefined;
|
|
778
|
+
};
|
|
779
|
+
onError: {
|
|
780
|
+
type: PropType<(error: Error) => void>;
|
|
781
|
+
default: undefined;
|
|
782
|
+
};
|
|
783
|
+
}>> & Readonly<{
|
|
784
|
+
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
785
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
786
|
+
}>, {
|
|
787
|
+
onSuccess: () => void;
|
|
788
|
+
onError: (error: Error) => void;
|
|
789
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
790
|
+
|
|
791
|
+
export { AUTH_OS_INJECTION_KEY, type AppearanceOptions, type AppearanceVariables, type AuthOSContext, type AuthOSPluginOptions, AuthOSProvider, type AuthOSState, Callback, type CallbackSlotProps, MagicLinkSignIn, OAuthButton, type OAuthButtonSlotProps, OrganizationSwitcher, type OrganizationSwitcherSlotProps, PasskeySignIn, Protect, SignIn, type SignInSlotProps, SignUp, type SignUpSlotProps, SignedIn, SignedOut, type SupportedOAuthProvider$1 as SupportedOAuthProvider, UserButton, type UserButtonSlotProps, createAuthOS, useAllPermissions, useAnyPermission, useAuthOS, useOrganization, usePermission, useUser };
|
package/dist/index.js
CHANGED
|
@@ -501,6 +501,16 @@ function createAuthOS(options) {
|
|
|
501
501
|
if (options.appearance?.variables) {
|
|
502
502
|
applyVariables(options.appearance.variables);
|
|
503
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
|
+
}
|
|
504
514
|
vue.nextTick(() => {
|
|
505
515
|
setInitialToken();
|
|
506
516
|
});
|
|
@@ -1062,8 +1072,8 @@ var SignUp = vue.defineComponent({
|
|
|
1062
1072
|
await client.auth.register({
|
|
1063
1073
|
email: email.value,
|
|
1064
1074
|
password: password.value,
|
|
1065
|
-
org_slug: props.orgSlug,
|
|
1066
|
-
service_slug: props.serviceSlug
|
|
1075
|
+
org_slug: props.orgSlug ?? options.org,
|
|
1076
|
+
service_slug: props.serviceSlug ?? options.service
|
|
1067
1077
|
});
|
|
1068
1078
|
isSuccess.value = true;
|
|
1069
1079
|
emit("success");
|
|
@@ -1558,6 +1568,77 @@ var PasskeySignIn = vue.defineComponent({
|
|
|
1558
1568
|
};
|
|
1559
1569
|
}
|
|
1560
1570
|
});
|
|
1571
|
+
var Callback = vue.defineComponent({
|
|
1572
|
+
name: "Callback",
|
|
1573
|
+
props: {
|
|
1574
|
+
onSuccess: {
|
|
1575
|
+
type: Function,
|
|
1576
|
+
default: void 0
|
|
1577
|
+
},
|
|
1578
|
+
onError: {
|
|
1579
|
+
type: Function,
|
|
1580
|
+
default: void 0
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1583
|
+
emits: ["success", "error"],
|
|
1584
|
+
setup(props, { slots, emit }) {
|
|
1585
|
+
const { client } = useAuthOS();
|
|
1586
|
+
const error = vue.ref(null);
|
|
1587
|
+
vue.onMounted(async () => {
|
|
1588
|
+
if (!client) {
|
|
1589
|
+
error.value = "AuthOS client not initialized";
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
const hash = window.location.hash.substring(1);
|
|
1593
|
+
const params = new URLSearchParams(hash);
|
|
1594
|
+
const accessToken = params.get("access_token");
|
|
1595
|
+
const refreshToken = params.get("refresh_token");
|
|
1596
|
+
const errorParam = params.get("error");
|
|
1597
|
+
const errorDescription = params.get("error_description");
|
|
1598
|
+
if (errorParam) {
|
|
1599
|
+
const msg = errorDescription || errorParam;
|
|
1600
|
+
error.value = msg;
|
|
1601
|
+
const e = new Error(msg);
|
|
1602
|
+
emit("error", e);
|
|
1603
|
+
props.onError?.(e);
|
|
1604
|
+
return;
|
|
1605
|
+
}
|
|
1606
|
+
if (accessToken) {
|
|
1607
|
+
try {
|
|
1608
|
+
await client.setSession({
|
|
1609
|
+
access_token: accessToken,
|
|
1610
|
+
refresh_token: refreshToken || void 0
|
|
1611
|
+
});
|
|
1612
|
+
emit("success");
|
|
1613
|
+
props.onSuccess?.();
|
|
1614
|
+
} catch (err) {
|
|
1615
|
+
const message = err.message || "Failed to set session";
|
|
1616
|
+
error.value = message;
|
|
1617
|
+
const e = err instanceof Error ? err : new Error(message);
|
|
1618
|
+
emit("error", e);
|
|
1619
|
+
props.onError?.(e);
|
|
1620
|
+
}
|
|
1621
|
+
} else {
|
|
1622
|
+
const message = "No authentication tokens found in callback URL.";
|
|
1623
|
+
error.value = message;
|
|
1624
|
+
const e = new Error(message);
|
|
1625
|
+
emit("error", e);
|
|
1626
|
+
props.onError?.(e);
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
return () => {
|
|
1630
|
+
const slotProps = {
|
|
1631
|
+
error: error.value
|
|
1632
|
+
};
|
|
1633
|
+
if (slots.default) {
|
|
1634
|
+
return slots.default(slotProps);
|
|
1635
|
+
}
|
|
1636
|
+
return vue.h("div", { "data-authos-callback": "" }, [
|
|
1637
|
+
error.value ? vue.h("div", { "data-authos-error": "" }, error.value) : vue.h("div", { "data-authos-loading": "" }, "Completing sign in...")
|
|
1638
|
+
]);
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1561
1642
|
|
|
1562
1643
|
Object.defineProperty(exports, "AuthErrorCodes", {
|
|
1563
1644
|
enumerable: true,
|
|
@@ -1577,6 +1658,7 @@ Object.defineProperty(exports, "SsoApiError", {
|
|
|
1577
1658
|
});
|
|
1578
1659
|
exports.AUTH_OS_INJECTION_KEY = AUTH_OS_INJECTION_KEY;
|
|
1579
1660
|
exports.AuthOSProvider = AuthOSProvider;
|
|
1661
|
+
exports.Callback = Callback;
|
|
1580
1662
|
exports.MagicLinkSignIn = MagicLinkSignIn;
|
|
1581
1663
|
exports.OAuthButton = OAuthButton;
|
|
1582
1664
|
exports.OrganizationSwitcher = OrganizationSwitcher;
|
package/dist/index.mjs
CHANGED
|
@@ -498,6 +498,16 @@ function createAuthOS(options) {
|
|
|
498
498
|
if (options.appearance?.variables) {
|
|
499
499
|
applyVariables(options.appearance.variables);
|
|
500
500
|
}
|
|
501
|
+
if (options.org && !options.service) {
|
|
502
|
+
console.warn(
|
|
503
|
+
'[AuthOS] You provided "org" but not "service". OAuth flows may not work correctly.'
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
if (!options.org && options.service) {
|
|
507
|
+
console.warn(
|
|
508
|
+
'[AuthOS] You provided "service" but not "org". OAuth flows may not work correctly.'
|
|
509
|
+
);
|
|
510
|
+
}
|
|
501
511
|
nextTick(() => {
|
|
502
512
|
setInitialToken();
|
|
503
513
|
});
|
|
@@ -1033,8 +1043,8 @@ var SignUp = defineComponent({
|
|
|
1033
1043
|
await client.auth.register({
|
|
1034
1044
|
email: email.value,
|
|
1035
1045
|
password: password.value,
|
|
1036
|
-
org_slug: props.orgSlug,
|
|
1037
|
-
service_slug: props.serviceSlug
|
|
1046
|
+
org_slug: props.orgSlug ?? options.org,
|
|
1047
|
+
service_slug: props.serviceSlug ?? options.service
|
|
1038
1048
|
});
|
|
1039
1049
|
isSuccess.value = true;
|
|
1040
1050
|
emit("success");
|
|
@@ -1529,5 +1539,76 @@ var PasskeySignIn = defineComponent({
|
|
|
1529
1539
|
};
|
|
1530
1540
|
}
|
|
1531
1541
|
});
|
|
1542
|
+
var Callback = defineComponent({
|
|
1543
|
+
name: "Callback",
|
|
1544
|
+
props: {
|
|
1545
|
+
onSuccess: {
|
|
1546
|
+
type: Function,
|
|
1547
|
+
default: void 0
|
|
1548
|
+
},
|
|
1549
|
+
onError: {
|
|
1550
|
+
type: Function,
|
|
1551
|
+
default: void 0
|
|
1552
|
+
}
|
|
1553
|
+
},
|
|
1554
|
+
emits: ["success", "error"],
|
|
1555
|
+
setup(props, { slots, emit }) {
|
|
1556
|
+
const { client } = useAuthOS();
|
|
1557
|
+
const error = ref(null);
|
|
1558
|
+
onMounted(async () => {
|
|
1559
|
+
if (!client) {
|
|
1560
|
+
error.value = "AuthOS client not initialized";
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
const hash = window.location.hash.substring(1);
|
|
1564
|
+
const params = new URLSearchParams(hash);
|
|
1565
|
+
const accessToken = params.get("access_token");
|
|
1566
|
+
const refreshToken = params.get("refresh_token");
|
|
1567
|
+
const errorParam = params.get("error");
|
|
1568
|
+
const errorDescription = params.get("error_description");
|
|
1569
|
+
if (errorParam) {
|
|
1570
|
+
const msg = errorDescription || errorParam;
|
|
1571
|
+
error.value = msg;
|
|
1572
|
+
const e = new Error(msg);
|
|
1573
|
+
emit("error", e);
|
|
1574
|
+
props.onError?.(e);
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
if (accessToken) {
|
|
1578
|
+
try {
|
|
1579
|
+
await client.setSession({
|
|
1580
|
+
access_token: accessToken,
|
|
1581
|
+
refresh_token: refreshToken || void 0
|
|
1582
|
+
});
|
|
1583
|
+
emit("success");
|
|
1584
|
+
props.onSuccess?.();
|
|
1585
|
+
} catch (err) {
|
|
1586
|
+
const message = err.message || "Failed to set session";
|
|
1587
|
+
error.value = message;
|
|
1588
|
+
const e = err instanceof Error ? err : new Error(message);
|
|
1589
|
+
emit("error", e);
|
|
1590
|
+
props.onError?.(e);
|
|
1591
|
+
}
|
|
1592
|
+
} else {
|
|
1593
|
+
const message = "No authentication tokens found in callback URL.";
|
|
1594
|
+
error.value = message;
|
|
1595
|
+
const e = new Error(message);
|
|
1596
|
+
emit("error", e);
|
|
1597
|
+
props.onError?.(e);
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
return () => {
|
|
1601
|
+
const slotProps = {
|
|
1602
|
+
error: error.value
|
|
1603
|
+
};
|
|
1604
|
+
if (slots.default) {
|
|
1605
|
+
return slots.default(slotProps);
|
|
1606
|
+
}
|
|
1607
|
+
return h("div", { "data-authos-callback": "" }, [
|
|
1608
|
+
error.value ? h("div", { "data-authos-error": "" }, error.value) : h("div", { "data-authos-loading": "" }, "Completing sign in...")
|
|
1609
|
+
]);
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1532
1613
|
|
|
1533
|
-
export { AuthOSProvider, MagicLinkSignIn, OAuthButton, OrganizationSwitcher, PasskeySignIn, Protect, SignIn, SignUp, SignedIn, SignedOut, UserButton, createAuthOS, useAllPermissions, useAnyPermission, useOrganization, usePermission, useUser };
|
|
1614
|
+
export { AuthOSProvider, Callback, MagicLinkSignIn, OAuthButton, OrganizationSwitcher, PasskeySignIn, Protect, SignIn, SignUp, SignedIn, SignedOut, UserButton, createAuthOS, useAllPermissions, useAnyPermission, useOrganization, usePermission, useUser };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Cu as parseJSON5, Au as stringifyJSON5 } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { Cu as parseJSON5, Au as stringifyJSON5 } from './chunk-EI6D7ZL6.mjs';
|
|
2
|
+
import './chunk-N667TIER.mjs';
|
|
3
3
|
import './chunk-6DZX6EAA.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { require_node, require_node_fetch_native_DhEqb06g } from './chunk-
|
|
1
|
+
import { require_node, require_node_fetch_native_DhEqb06g } from './chunk-HVM6PT6I.mjs';
|
|
2
2
|
import { __commonJS, __require } from './chunk-6DZX6EAA.mjs';
|
|
3
3
|
|
|
4
|
-
// node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs
|
|
4
|
+
// ../../node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs
|
|
5
5
|
var require_multipart_parser = __commonJS({
|
|
6
|
-
"node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs"(exports$1) {
|
|
6
|
+
"../../node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs"(exports$1) {
|
|
7
7
|
var y = Object.defineProperty;
|
|
8
8
|
var c = (R, o) => y(R, "name", { value: o, configurable: true });
|
|
9
9
|
var node = require_node();
|
|
@@ -168,6 +168,6 @@ var require_multipart_parser = __commonJS({
|
|
|
168
168
|
c(toFormData, "toFormData"), exports$1.toFormData = toFormData;
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
|
-
var
|
|
171
|
+
var multipartParserSFUPTK6X = require_multipart_parser();
|
|
172
172
|
|
|
173
|
-
export {
|
|
173
|
+
export { multipartParserSFUPTK6X as default };
|