@meistrari/auth-nuxt 3.12.0 → 3.13.1
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 +1 -1
- package/dist/module.d.mts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -0
- package/dist/runtime/composables/application/auth.d.ts +2 -2
- package/dist/runtime/composables/application/auth.js +1 -1
- package/dist/runtime/composables/core-auth-client.d.ts +10 -0
- package/dist/runtime/composables/core-auth-client.js +12 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ A Nuxt module for authentication, organization management, and API key capabilit
|
|
|
7
7
|
This SDK supports two authentication models:
|
|
8
8
|
|
|
9
9
|
- **Application Authentication (recommended)**: Use this for product applications that need end-user authentication and authorization scoped to a specific application. See [Application Authentication Guide](./docs/APPLICATION_AUTH.md).
|
|
10
|
-
- **First-Party Authentication**: Use this only for trusted first-party tools that interact directly with the Auth API in an administrative way, such as the
|
|
10
|
+
- **First-Party Authentication**: Use this only for trusted first-party tools that interact directly with the Auth API in an administrative way, such as the Accounts Dashboard and Backoffice. See [First-Party Authentication Guide](./docs/FIRST_PARTY_AUTH.md).
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
package/dist/module.d.mts
CHANGED
|
@@ -33,7 +33,7 @@ interface ModuleOptions {
|
|
|
33
33
|
application?: {
|
|
34
34
|
/** Whether to enable application authentication */
|
|
35
35
|
enabled: boolean;
|
|
36
|
-
/**
|
|
36
|
+
/** Accounts Dashboard URL */
|
|
37
37
|
dashboardUrl: string;
|
|
38
38
|
/** The ID of the application to authenticate with */
|
|
39
39
|
applicationId: string;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -115,6 +115,11 @@ const module$1 = defineNuxtModule({
|
|
|
115
115
|
as: "useTelaOrganization",
|
|
116
116
|
from: resolver.resolve("runtime/composables/organization")
|
|
117
117
|
});
|
|
118
|
+
addImports({
|
|
119
|
+
name: "useCoreAuthClient",
|
|
120
|
+
as: "useCoreAuthClient",
|
|
121
|
+
from: resolver.resolve("runtime/composables/core-auth-client")
|
|
122
|
+
});
|
|
118
123
|
addImports({
|
|
119
124
|
name: "useTelaAdmin",
|
|
120
125
|
as: "useTelaAdmin",
|
|
@@ -10,7 +10,7 @@ export interface UseTelaApplicationAuthReturn {
|
|
|
10
10
|
*
|
|
11
11
|
* Calls the server route to generate state and challenge. The server stores the
|
|
12
12
|
* verifier securely and returns only the challenge and state to the client.
|
|
13
|
-
* Then redirects to the
|
|
13
|
+
* Then redirects to the accounts dashboard login page.
|
|
14
14
|
*
|
|
15
15
|
* @throws {AuthorizationFlowError} If called on the server
|
|
16
16
|
*/
|
|
@@ -87,7 +87,7 @@ export interface UseTelaApplicationAuthReturn {
|
|
|
87
87
|
* from the returned state.
|
|
88
88
|
*
|
|
89
89
|
* @returns An object containing authentication state and methods
|
|
90
|
-
* @throws {Error} If
|
|
90
|
+
* @throws {Error} If accounts dashboard URL is not configured
|
|
91
91
|
*
|
|
92
92
|
* @example
|
|
93
93
|
* ```ts
|
|
@@ -15,7 +15,7 @@ export function useTelaApplicationAuth() {
|
|
|
15
15
|
const state = useApplicationSessionState();
|
|
16
16
|
if (!appConfig.application?.dashboardUrl) {
|
|
17
17
|
throw new Error(
|
|
18
|
-
"[Tela Auth SDK]
|
|
18
|
+
"[Tela Auth SDK] Accounts dashboard URL is not configured, but it is required to use application authentication."
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
if (!appConfig.application?.applicationId) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AuthClient } from '@meistrari/auth-core';
|
|
2
|
+
/**
|
|
3
|
+
* **DO NOT USE** this directly unless you're working on the internals of the Auth System.
|
|
4
|
+
*
|
|
5
|
+
* Allows access to the core AuthClient instance configured for use within a Nuxt application.
|
|
6
|
+
* This makes it possible to use SDKs features not directly exposed by the `@meistrari/auth-nuxt` package.
|
|
7
|
+
*
|
|
8
|
+
* @returns The configured core AuthClient instance
|
|
9
|
+
*/
|
|
10
|
+
export declare function useCoreAuthClient(): AuthClient;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useCookie, useRuntimeConfig } from "#app";
|
|
2
|
+
import { createNuxtAuthClient } from "../shared.js";
|
|
3
|
+
let client;
|
|
4
|
+
export function useCoreAuthClient() {
|
|
5
|
+
const { application, apiUrl, jwtCookieName } = useRuntimeConfig().public.telaAuth;
|
|
6
|
+
if (application?.enabled) {
|
|
7
|
+
throw new Error("Core AuthClient is not available for applications");
|
|
8
|
+
}
|
|
9
|
+
const cookie = useCookie(jwtCookieName);
|
|
10
|
+
client ??= createNuxtAuthClient(apiUrl, () => cookie.value ?? null);
|
|
11
|
+
return client;
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/auth-nuxt",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"docs": "nuxt-module-build prepare && typedoc"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@meistrari/auth-core": "1.
|
|
39
|
+
"@meistrari/auth-core": "1.24.0",
|
|
40
40
|
"jose": "6.1.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|