@thunderid/nuxt 0.2.0 → 0.2.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/dist/module.json +1 -1
- package/dist/runtime/components/auth/SignUp.js +1 -4
- package/dist/runtime/composables/useThunderID.js +1 -12
- package/dist/runtime/server/ThunderIDNuxtClient.d.ts +2 -3
- package/dist/runtime/server/ThunderIDNuxtClient.js +3 -34
- package/dist/runtime/server/routes/auth/session/signin.post.d.ts +1 -1
- package/dist/runtime/server/routes/auth/session/signin.post.js +1 -1
- package/dist/runtime/server/routes/auth/session/signup.post.js +2 -2
- package/dist/runtime/types.d.ts +1 -7
- package/package.json +9 -9
package/dist/module.json
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { navigateTo } from "#app";
|
|
2
|
-
import {
|
|
3
|
-
EmbeddedFlowResponseType,
|
|
4
|
-
EmbeddedFlowType
|
|
5
|
-
} from "@thunderid/browser";
|
|
2
|
+
import { EmbeddedFlowResponseType, EmbeddedFlowType } from "@thunderid/browser";
|
|
6
3
|
import { BaseSignUp } from "@thunderid/vue";
|
|
7
4
|
import { defineComponent, h } from "vue";
|
|
8
5
|
import { useThunderID } from "#imports";
|
|
@@ -24,7 +24,7 @@ export function useThunderID() {
|
|
|
24
24
|
}
|
|
25
25
|
return {
|
|
26
26
|
authData: {},
|
|
27
|
-
flowStatus: EmbeddedSignInFlowStatus.
|
|
27
|
+
flowStatus: EmbeddedSignInFlowStatus.Complete
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
return res.data;
|
|
@@ -41,17 +41,6 @@ export function useThunderID() {
|
|
|
41
41
|
};
|
|
42
42
|
const signUp = async (...args) => {
|
|
43
43
|
const payload = args[0];
|
|
44
|
-
if (payload && typeof payload === "object" && "flowType" in payload) {
|
|
45
|
-
const res = await $fetch("/api/auth/signup", {
|
|
46
|
-
body: { payload },
|
|
47
|
-
method: "POST"
|
|
48
|
-
});
|
|
49
|
-
if (res.data?.afterSignUpUrl) {
|
|
50
|
-
await navigateTo(res.data.afterSignUpUrl, { external: false });
|
|
51
|
-
return void 0;
|
|
52
|
-
}
|
|
53
|
-
return res.data;
|
|
54
|
-
}
|
|
55
44
|
const cfg = useRuntimeConfig().public.thunderid ?? {};
|
|
56
45
|
if (cfg.signUpUrl) {
|
|
57
46
|
await navigateTo(cfg.signUpUrl, { external: true });
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { ThunderIDNodeClient, type IdToken, type Organization, type OrganizationDetails, type CreateOrganizationPayload, type Storage, type TokenExchangeRequestConfig, type TokenResponse, type User, type UserProfile, type UpdateMeProfileConfig, type AllOrganizationsApiResponse, type
|
|
18
|
+
import { ThunderIDNodeClient, type IdToken, type Organization, type OrganizationDetails, type CreateOrganizationPayload, type Storage, type TokenExchangeRequestConfig, type TokenResponse, type User, type UserProfile, type UpdateMeProfileConfig, type AllOrganizationsApiResponse, type ExtendedAuthorizeRequestUrlParams, type SignUpOptions, type GetBrandingPreferenceConfig, type BrandingPreference } from '@thunderid/node';
|
|
19
19
|
import type { ThunderIDNuxtConfig, ThunderIDSessionPayload } from '../types.js';
|
|
20
20
|
declare class ThunderIDNuxtClient extends ThunderIDNodeClient<ThunderIDNuxtConfig> {
|
|
21
21
|
private static instance;
|
|
@@ -26,8 +26,7 @@ declare class ThunderIDNuxtClient extends ThunderIDNodeClient<ThunderIDNuxtConfi
|
|
|
26
26
|
reInitialize(config: Partial<ThunderIDNuxtConfig>): Promise<boolean>;
|
|
27
27
|
rehydrateSessionFromPayload(session: ThunderIDSessionPayload): Promise<void>;
|
|
28
28
|
signIn(...args: any[]): Promise<any>;
|
|
29
|
-
signUp(
|
|
30
|
-
signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
|
|
29
|
+
signUp(_options?: SignUpOptions): Promise<void>;
|
|
31
30
|
getAuthorizeRequestUrl(customParams: ExtendedAuthorizeRequestUrlParams, userId?: string): Promise<string>;
|
|
32
31
|
signOut(...args: any[]): Promise<string>;
|
|
33
32
|
getUser(sessionId?: string): Promise<User>;
|
|
@@ -4,10 +4,7 @@ import {
|
|
|
4
4
|
getMeOrganizations,
|
|
5
5
|
getAllOrganizations,
|
|
6
6
|
createOrganization,
|
|
7
|
-
getOrganization
|
|
8
|
-
initializeEmbeddedSignInFlow,
|
|
9
|
-
executeEmbeddedSignInFlow,
|
|
10
|
-
executeEmbeddedSignUpFlow
|
|
7
|
+
getOrganization
|
|
11
8
|
} from "@thunderid/node";
|
|
12
9
|
class ThunderIDNuxtClient extends ThunderIDNodeClient {
|
|
13
10
|
static instance;
|
|
@@ -66,25 +63,6 @@ class ThunderIDNuxtClient extends ThunderIDNodeClient {
|
|
|
66
63
|
}
|
|
67
64
|
signIn(...args) {
|
|
68
65
|
const arg0 = args[0];
|
|
69
|
-
if (typeof arg0 === "object" && arg0 !== null && "flowId" in arg0) {
|
|
70
|
-
const sessionId = args[2];
|
|
71
|
-
if (arg0.flowId === "") {
|
|
72
|
-
return this.getSignInUrl({ client_secret: "{{clientSecret}}", response_mode: "direct" }, sessionId).then(
|
|
73
|
-
(authorizeUrl) => {
|
|
74
|
-
const url = new URL(authorizeUrl);
|
|
75
|
-
return initializeEmbeddedSignInFlow({
|
|
76
|
-
payload: Object.fromEntries(url.searchParams.entries()),
|
|
77
|
-
url: `${url.origin}${url.pathname}`
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
const request = args[1] ?? {};
|
|
83
|
-
return executeEmbeddedSignInFlow({
|
|
84
|
-
payload: arg0,
|
|
85
|
-
url: request.url
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
66
|
if (typeof arg0 === "object" && arg0 !== null && ("code" in arg0 || "state" in arg0)) {
|
|
89
67
|
const payload = arg0;
|
|
90
68
|
const code = typeof payload.code === "string" ? payload.code : void 0;
|
|
@@ -98,17 +76,8 @@ class ThunderIDNuxtClient extends ThunderIDNodeClient {
|
|
|
98
76
|
}
|
|
99
77
|
return super.signIn(args[0], args[1], args[2], args[3], args[4], args[5]);
|
|
100
78
|
}
|
|
101
|
-
async signUp(
|
|
102
|
-
|
|
103
|
-
return void 0;
|
|
104
|
-
}
|
|
105
|
-
const configData = this.getStorageManager().getConfigData();
|
|
106
|
-
const baseUrl = configData?.baseUrl;
|
|
107
|
-
const response = await executeEmbeddedSignUpFlow({
|
|
108
|
-
baseUrl,
|
|
109
|
-
payload: payloadOrOptions
|
|
110
|
-
});
|
|
111
|
-
return response;
|
|
79
|
+
async signUp(_options) {
|
|
80
|
+
return void 0;
|
|
112
81
|
}
|
|
113
82
|
async getAuthorizeRequestUrl(customParams, userId) {
|
|
114
83
|
return this.getSignInUrl(customParams, userId);
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Handles embedded (app-native) sign-in flow steps.
|
|
22
22
|
*
|
|
23
23
|
* Request body:
|
|
24
|
-
* - `payload` — the embedded flow step payload
|
|
24
|
+
* - `payload` — the embedded flow step payload.
|
|
25
25
|
* When omitted or `{}`, the flow is initialised and the authorize URL is returned.
|
|
26
26
|
* - `request` — optional per-step config (e.g. `{ url }` override).
|
|
27
27
|
*
|
|
@@ -66,7 +66,7 @@ export default defineEventHandler(async (event) => {
|
|
|
66
66
|
statusMessage: `Embedded sign-in step failed: ${err?.message ?? String(err)}`
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
if (response?.flowStatus === EmbeddedSignInFlowStatus.
|
|
69
|
+
if (response?.flowStatus === EmbeddedSignInFlowStatus.Complete) {
|
|
70
70
|
const authData = response?.authData ?? {};
|
|
71
71
|
const { code, state, session_state: sessionState } = authData;
|
|
72
72
|
if (!code) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmbeddedSignUpFlowStatus } from "@thunderid/node";
|
|
2
2
|
import { defineEventHandler, readBody, createError } from "h3";
|
|
3
3
|
import ThunderIDNuxtClient from "../../../ThunderIDNuxtClient.js";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
@@ -23,7 +23,7 @@ export default defineEventHandler(async (event) => {
|
|
|
23
23
|
statusMessage: `Embedded sign-up step failed: ${err?.message ?? String(err)}`
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
if (hasFlowStatus(response) && response.flowStatus ===
|
|
26
|
+
if (hasFlowStatus(response) && response.flowStatus === EmbeddedSignUpFlowStatus.Complete) {
|
|
27
27
|
return { data: { afterSignUpUrl }, success: true };
|
|
28
28
|
}
|
|
29
29
|
return { data: response, success: true };
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import type { BrandingPreference, I18nPreferences, Organization,
|
|
18
|
+
import type { BrandingPreference, I18nPreferences, Organization, TokenEndpointAuthMethod, User, UserProfile } from '@thunderid/node';
|
|
19
19
|
import type { JWTPayload } from 'jose';
|
|
20
20
|
/**
|
|
21
21
|
* Configuration for the ThunderID Nuxt module.
|
|
@@ -36,12 +36,6 @@ export interface ThunderIDNuxtConfig {
|
|
|
36
36
|
clientId?: string;
|
|
37
37
|
/** OAuth2 Client Secret (server-only, use THUNDERID_CLIENT_SECRET env var) */
|
|
38
38
|
clientSecret?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Identity platform variant. Set to `Platform.ThunderID` when connecting to
|
|
41
|
-
* a Thunder (ThunderIDV2) instance. Forwarded to the underlying Node client so
|
|
42
|
-
* platform-specific behaviours (e.g. issuer resolution) apply correctly.
|
|
43
|
-
*/
|
|
44
|
-
platform?: keyof typeof Platform;
|
|
45
39
|
/**
|
|
46
40
|
* Feature-gating preferences that control which server-side data fetches
|
|
47
41
|
* the Nitro plugin performs on every SSR request.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thunderid/nuxt",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Nuxt SDK for ThunderID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thunderid",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"nuxtjs",
|
|
9
9
|
"ssr"
|
|
10
10
|
],
|
|
11
|
-
"homepage": "https://github.com/thunder-id/
|
|
11
|
+
"homepage": "https://github.com/thunder-id/javascript-sdks/tree/main/packages/nuxt#readme",
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/thunder-id/thunderid/issues"
|
|
14
14
|
},
|
|
@@ -57,30 +57,30 @@
|
|
|
57
57
|
],
|
|
58
58
|
"repository": {
|
|
59
59
|
"type": "git",
|
|
60
|
-
"url": "https://github.com/thunder-id/
|
|
60
|
+
"url": "https://github.com/thunder-id/javascript-sdks",
|
|
61
61
|
"directory": "packages/nuxt"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@nuxt/kit": "3.21.7",
|
|
65
65
|
"defu": "6.1.5",
|
|
66
66
|
"jose": "5.2.0",
|
|
67
|
-
"@thunderid/
|
|
68
|
-
"@thunderid/
|
|
69
|
-
"@thunderid/
|
|
67
|
+
"@thunderid/browser": "^0.3.1",
|
|
68
|
+
"@thunderid/node": "^0.2.1",
|
|
69
|
+
"@thunderid/vue": "^0.3.3"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@nuxt/devtools": "2.6.4",
|
|
73
73
|
"@nuxt/module-builder": "1.0.1",
|
|
74
74
|
"@nuxt/schema": "3.21.7",
|
|
75
75
|
"@nuxt/test-utils": "3.17.2",
|
|
76
|
+
"@thunderid/eslint-plugin": "0.0.2",
|
|
77
|
+
"@thunderid/prettier-config": "0.0.2",
|
|
76
78
|
"@types/node": "24.7.2",
|
|
77
79
|
"eslint": "9.39.4",
|
|
78
80
|
"h3": "1.15.11",
|
|
79
81
|
"nuxt": "3.21.7",
|
|
80
82
|
"typescript": "5.9.3",
|
|
81
|
-
"vitest": "4.1.8"
|
|
82
|
-
"@thunderid/eslint-plugin": "^0.0.0",
|
|
83
|
-
"@thunderid/prettier-config": "^0.0.0"
|
|
83
|
+
"vitest": "4.1.8"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"nuxt": ">=3.10.0",
|