@moreillon/vue-oidc 0.0.9 → 0.0.11
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 +29 -21
- package/dist/composables/useAuth.d.ts +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,33 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Vue OIDC
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Usage example
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```ts
|
|
6
|
+
import { createApp } from "vue";
|
|
7
|
+
import { createPinia } from "pinia";
|
|
8
|
+
import { auth } from "@moreillon/vue-oidc";
|
|
9
|
+
import App from "./App.vue";
|
|
10
|
+
import router from "./router";
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
const app = createApp(App);
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
const { VITE_OIDC_AUTHORITY, VITE_OIDC_CLIENT_ID } = import.meta.env;
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
app.use(auth, {
|
|
17
|
+
authority: VITE_OIDC_AUTHORITY,
|
|
18
|
+
client_id: VITE_OIDC_CLIENT_ID,
|
|
19
|
+
});
|
|
20
|
+
app.use(createPinia());
|
|
21
|
+
app.use(router);
|
|
12
22
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
See [Vite Configuration Reference](https://vite.dev/config/).
|
|
16
|
-
|
|
17
|
-
## Project Setup
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
npm install
|
|
23
|
+
app.mount("#app");
|
|
21
24
|
```
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
Then in your components:
|
|
24
27
|
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
```vue
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import { useAuth } from "@moreillon/vue-oidc";
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
const { user } = useAuth();
|
|
33
|
+
</script>
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
<template>
|
|
36
|
+
<h1>User</h1>
|
|
37
|
+
<p>
|
|
38
|
+
{{ user }}
|
|
39
|
+
</p>
|
|
40
|
+
</template>
|
|
33
41
|
```
|
|
@@ -34,7 +34,7 @@ export default function (): {
|
|
|
34
34
|
getUser: () => Promise<any>;
|
|
35
35
|
refreshAccessToken: (oidcConfig: import("@moreillon/oidc-auth").OidcConfig) => Promise<void>;
|
|
36
36
|
onTokenRefreshed: (handler: (oidcData: import("@moreillon/oidc-auth").Tokens) => void) => void;
|
|
37
|
-
runRefreshEventHandlers: (
|
|
37
|
+
runRefreshEventHandlers: () => void;
|
|
38
38
|
login: () => void;
|
|
39
39
|
logout: () => void;
|
|
40
40
|
} | null, OidcClient | {
|
|
@@ -69,7 +69,7 @@ export default function (): {
|
|
|
69
69
|
getUser: () => Promise<any>;
|
|
70
70
|
refreshAccessToken: (oidcConfig: import("@moreillon/oidc-auth").OidcConfig) => Promise<void>;
|
|
71
71
|
onTokenRefreshed: (handler: (oidcData: import("@moreillon/oidc-auth").Tokens) => void) => void;
|
|
72
|
-
runRefreshEventHandlers: (
|
|
72
|
+
runRefreshEventHandlers: () => void;
|
|
73
73
|
login: () => void;
|
|
74
74
|
logout: () => void;
|
|
75
75
|
} | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moreillon/vue-oidc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"build": "tsc"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@moreillon/oidc-auth": "^3.0.
|
|
14
|
+
"@moreillon/oidc-auth": "^3.0.4",
|
|
15
15
|
"vue": "^3.5.17"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|