@asgardeo/vue 0.0.1 → 0.0.2

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 CHANGED
@@ -1,31 +1,30 @@
1
- # @asgardeo/vue
2
-
3
- <p align="center" style="font-size: 1.2rem;">Vue Wrapper to build customizable login UIs for Asgardeo or Identity Server</p>
4
-
1
+ <p align="center" style="color: #343a40">
2
+ <h1 align="center">@asgardeo/vue</h1>
3
+ </p>
4
+ <p align="center" style="font-size: 1.2rem;">Vue.js SDK for Asgardeo</p>
5
5
  <div align="center">
6
6
  <img alt="npm (scoped)" src="https://img.shields.io/npm/v/@asgardeo/vue">
7
7
  <img alt="npm" src="https://img.shields.io/npm/dw/@asgardeo/vue">
8
8
  <a href="./LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a>
9
9
  </div>
10
10
 
11
- ## Prerequisites
12
- - Vue.js 3.4.0 or higher
13
-
14
11
  ## Installation
15
12
 
16
13
  ```bash
17
- # With npm
14
+ # Using npm
18
15
  npm install @asgardeo/vue
19
16
 
20
- # With pnpm
17
+ # or using pnpm
21
18
  pnpm add @asgardeo/vue
22
19
 
23
- # With yarn
20
+ # or using yarn
24
21
  yarn add @asgardeo/vue
25
22
  ```
26
23
 
27
24
  ## Basic Setup
28
25
 
26
+ 1. Configure the authentication plugin:
27
+
29
28
  ```typescript
30
29
  import { createApp } from 'vue'
31
30
  import { AsgardeoAuth } from '@asgardeo/vue'
@@ -33,9 +32,9 @@ import { AsgardeoAuth } from '@asgardeo/vue'
33
32
  const app = createApp(App)
34
33
 
35
34
  app.use(AsgardeoAuth, {
36
- signInRedirectURL: "http://localhost:3000",
37
- signOutRedirectURL: "http://localhost:3000",
38
- clientID: "<your-client-id>",
35
+ afterSignInUrl: "http://localhost:3000",
36
+ afterSignOutUrl: "http://localhost:3000",
37
+ clientId: "<your-client-id>",
39
38
  baseUrl: "https://api.asgardeo.io/t/<org-name>",
40
39
  scope: ["openid", "profile"]
41
40
  })
@@ -43,6 +42,61 @@ app.use(AsgardeoAuth, {
43
42
  app.mount('#app')
44
43
  ```
45
44
 
45
+ 2. Use in your components:
46
+
47
+ ```vue
48
+ <template>
49
+ <div>
50
+ <div v-if="auth.isSignedIn">
51
+ <p>Welcome, {{ auth.user?.username }}</p>
52
+ <button @click="auth.signOut">Sign Out</button>
53
+ </div>
54
+ <button v-else @click="auth.signIn">Sign In</button>
55
+ </div>
56
+ </template>
57
+
58
+ <script setup>
59
+ import { useAsgardeo } from '@asgardeo/vue'
60
+
61
+ const auth = useAsgardeo()
62
+ </script>
63
+ ```
64
+
65
+ ## Composables
66
+
67
+ - `useAsgardeo()`: Main composable that provides:
68
+ - `isSignedIn`: Boolean indicating authentication status
69
+ - `user`: Current user information
70
+ - `signIn()`: Function to initiate sign in
71
+ - `signOut()`: Function to sign out
72
+ - `getAccessToken()`: Function to get the current access token
73
+ - `getUser()`: Function to get basic user information
74
+
75
+ - `useAuthContext()`: Composable to access the raw authentication context
76
+ - `useIsAuthenticated()`: Composable to check authentication status
77
+
78
+ ## Development
79
+
80
+ 1. Install dependencies:
81
+ ```bash
82
+ pnpm install
83
+ ```
84
+
85
+ 2. Build:
86
+ ```bash
87
+ pnpm build
88
+ ```
89
+
90
+ 3. Run tests:
91
+ ```bash
92
+ pnpm test
93
+ ```
94
+
95
+ 4. Run development server:
96
+ ```bash
97
+ pnpm dev
98
+ ```
99
+
46
100
  ## License
47
101
 
48
- Licenses this source under the Apache License, Version 2.0 [LICENSE](./LICENSE), You may not use this file except in compliance with the License.
102
+ Apache License, Version 2.0 - see [LICENSE](./LICENSE) for details.