@authup/client-web-nuxt 1.0.0-beta.46 → 1.0.0-beta.48
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
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
clearAuthorizationRequest,
|
|
2
3
|
injectStore,
|
|
4
|
+
loadAuthorizationRequest,
|
|
3
5
|
storeToRefs
|
|
4
6
|
} from "@authup/client-web-kit";
|
|
5
7
|
import { hasOwnProperty, omitRecord } from "@authup/kit";
|
|
@@ -20,14 +22,46 @@ export class RoutingInterceptor {
|
|
|
20
22
|
async execute(to, from) {
|
|
21
23
|
const code = typeof to.query.code === "string" ? to.query.code : void 0;
|
|
22
24
|
if (code) {
|
|
25
|
+
if (import.meta.server) {
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
const request = loadAuthorizationRequest();
|
|
23
29
|
try {
|
|
24
|
-
|
|
30
|
+
if (request) {
|
|
31
|
+
const state = typeof to.query.state === "string" ? to.query.state : void 0;
|
|
32
|
+
if (request.state !== state) {
|
|
33
|
+
throw new Error("The authorization request state does not match.");
|
|
34
|
+
}
|
|
35
|
+
await this.store.exchangeAuthorizationCode(code, {
|
|
36
|
+
code_verifier: request.code_verifier,
|
|
37
|
+
redirect_uri: request.redirect_uri,
|
|
38
|
+
client_id: request.client_id,
|
|
39
|
+
realm_id: request.realm_id
|
|
40
|
+
});
|
|
41
|
+
} else {
|
|
42
|
+
await this.store.exchangeAuthorizationCode(code);
|
|
43
|
+
}
|
|
44
|
+
clearAuthorizationRequest();
|
|
45
|
+
if (request?.target) {
|
|
46
|
+
const url = new URL(request.target, "http://localhost");
|
|
47
|
+
return {
|
|
48
|
+
path: url.pathname,
|
|
49
|
+
query: Object.fromEntries(url.searchParams.entries()),
|
|
50
|
+
hash: url.hash
|
|
51
|
+
};
|
|
52
|
+
}
|
|
25
53
|
return {
|
|
26
54
|
path: to.path,
|
|
27
|
-
query: omitRecord(to.query, ["code"]),
|
|
55
|
+
query: omitRecord(to.query, ["code", "state"]),
|
|
28
56
|
hash: to.hash
|
|
29
57
|
};
|
|
30
58
|
} catch {
|
|
59
|
+
clearAuthorizationRequest();
|
|
60
|
+
return {
|
|
61
|
+
path: to.path,
|
|
62
|
+
query: omitRecord(to.query, ["code", "state"]),
|
|
63
|
+
hash: to.hash
|
|
64
|
+
};
|
|
31
65
|
}
|
|
32
66
|
}
|
|
33
67
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authup/client-web-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.48",
|
|
5
5
|
"description": "Nuxt module for the authup ecosystem",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"node": "^20.19.0 || ^22.13.0 || ^23.5.0 || >=24.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@authup/access": "^1.0.0-beta.
|
|
34
|
-
"@authup/client-web-kit": "^1.0.0-beta.
|
|
35
|
-
"@authup/kit": "^1.0.0-beta.
|
|
33
|
+
"@authup/access": "^1.0.0-beta.48",
|
|
34
|
+
"@authup/client-web-kit": "^1.0.0-beta.48",
|
|
35
|
+
"@authup/kit": "^1.0.0-beta.48",
|
|
36
36
|
"@nuxt/kit": "^4.0.0",
|
|
37
37
|
"pathtrace": "^2.2.0",
|
|
38
38
|
"smob": "^1.6.1"
|