-
Notifications
You must be signed in to change notification settings - Fork 49
chore(vue): initialize vue.js sample app #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fc34501
chore(sample-app): 🎉 init vue vite sample app
3nethz 57f8e7e
chore(workspace): remove unnecessary .gitkeep
3nethz 6c77c74
Merge branch 'asgardeo:main' into feat/vue-sdk
3nethz ef5f3fc
chore(sample-app): change app title, update readme.md
3nethz 46a9853
chore(sample-app): add license header
3nethz a862899
chore(sample-app): update config, readme, add favicon
3nethz ba06316
chore(sample-app): add asgardeo logo
3nethz 76259ad
chore(sample-app): remove unnecessary files
3nethz 229cd13
chore(sample-app): remove unnecessary lines
3nethz 29a6723
configure typescript version
3nethz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}] | ||
| charset = utf-8 | ||
| indent_size = 2 | ||
| indent_style = space | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
|
|
||
| end_of_line = lf | ||
| max_line_length = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * text=auto eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| node_modules | ||
| .DS_Store | ||
| dist | ||
| dist-ssr | ||
| coverage | ||
| *.local | ||
|
|
||
| /cypress/videos/ | ||
| /cypress/screenshots/ | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
|
|
||
| *.tsbuildinfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
| { | ||
| "$schema": "https://json.schemastore.org/prettierrc", | ||
| "semi": false, | ||
| "singleQuote": true, | ||
| "printWidth": 100 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "recommendations": [ | ||
| "Vue.volar", | ||
| "vitest.explorer", | ||
| "dbaeumer.vscode-eslint", | ||
| "EditorConfig.EditorConfig", | ||
| "esbenp.prettier-vscode" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # Asgardeo Auth Vue.js SDK Usage Example (Single Page Application) | ||
|
|
||
| This sample is developed to demonstrate the basic usage of the Asgardeo Auth Vue.js SDK. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Prerequisites | ||
| - `Node.js` (version 20 or above). | ||
|
|
||
| ### Register an Application | ||
| //TODO | ||
|
|
||
| Make sure to add `http://localhost:5173` as a Redirect URL and also add it under allowed origins. | ||
|
|
||
| ### Download the Sample | ||
| //TODO | ||
|
|
||
| ### Configure the Sample | ||
|
|
||
| Update the authentication configuration in your `main.ts` file with your registered app details. | ||
|
|
||
| **Note:** You will need to paste in the `client ID` generated for the application you registered. | ||
|
|
||
| ```typescript | ||
| import "./assets/main.css"; | ||
| import { createApp } from "vue"; | ||
| import App from "./App.vue"; | ||
| import router from "./router"; | ||
| import { asgardeoPlugin } from "./auth/authprovider"; | ||
|
|
||
| const app = createApp(App); | ||
|
|
||
| app.use(router); | ||
| app.use(asgardeoPlugin, { | ||
| signInRedirectURL: "http://localhost:5173/", | ||
| signOutRedirectURL: "http://localhost:5173/", | ||
| clientID: "<ADD_CLIENT_ID_HERE>", | ||
| baseUrl: "https://api.asgardeo.io/t/<org_name>", | ||
| }); | ||
|
|
||
| app.mount("#app"); | ||
| ``` | ||
|
|
||
| ### Run the Application | ||
|
|
||
| ```bash | ||
| npm install && npm run dev | ||
| ``` | ||
|
|
||
| The app should open at [`http://localhost:5173`](http://localhost:5173) | ||
|
|
||
| ### Change the Application's Development Server Port | ||
|
|
||
| By default, the Vite development server runs on port `5173`. In case you wish to change this to something else, follow the steps below. | ||
|
|
||
| 1. Update the port in your Vite configuration file (`vite.config.js` or `vite.config.ts`): | ||
| ```javascript | ||
| export default defineConfig({ | ||
| // Other config options... | ||
| server: { | ||
| port: YOUR_PREFERRED_PORT | ||
| } | ||
| }) | ||
| ``` | ||
|
|
||
| 2. Update the `signInRedirectURL` & `signOutRedirectURL` in `main.ts` to match your new port. | ||
|
|
||
| 3. Go to the Asgardeo Console and navigate to the protocol tab of your application: | ||
| - Update the Authorized Redirect URL. | ||
| - Update the Allowed Origins. | ||
|
|
||
| ## Using the Auth Plugin | ||
|
|
||
| The Asgardeo Auth plugin is available throughout your Vue application. Here's how to use it in your components: | ||
|
|
||
| ```vue | ||
| <script setup> | ||
| import { useAsgardeo } from '@asgardeo/vue'; | ||
|
|
||
| const { isAuthenticated, signIn, signOut, getBasicUserInfo } = useAsgardeo(); | ||
| </script> | ||
|
|
||
| <template> | ||
| <div> | ||
| <button v-if="!isAuthenticated" @click="signIn">Login</button> | ||
| <button v-else @click="signOut">Logout</button> | ||
| </div> | ||
| </template> | ||
| ``` | ||
|
|
||
| //TODO | ||
|
|
||
| ## Contribute | ||
|
|
||
| Please read [Contributing to the Code Base](../../CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. | ||
|
|
||
| ### Reporting Issues | ||
|
|
||
| We encourage you to report issues, improvements, and feature requests by creating [Github Issues](https://github.com/asgardeo/web-ui-sdks/issues). | ||
|
|
||
| Important: Please be advised that security issues must be reported to [email protected], not as GitHub issues, in order to reach the proper audience. We strongly advise following the WSO2 Security Vulnerability Reporting Guidelines when reporting security issues. | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the Apache License 2.0. See the [LICENSE](../../LICENSE) file for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /// <reference types="vite/client" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /** | ||
| * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import pluginVue from 'eslint-plugin-vue' | ||
| import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript' | ||
| import pluginVitest from '@vitest/eslint-plugin' | ||
| import skipFormatting from '@vue/eslint-config-prettier/skip-formatting' | ||
|
|
||
| // To allow more languages other than `ts` in `.vue` files, uncomment the following lines: | ||
| // import { configureVueProject } from '@vue/eslint-config-typescript' | ||
| // configureVueProject({ scriptLangs: ['ts', 'tsx'] }) | ||
| // More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup | ||
|
|
||
| export default defineConfigWithVueTs( | ||
| { | ||
| name: 'app/files-to-lint', | ||
| files: ['**/*.{ts,mts,tsx,vue}'], | ||
| }, | ||
| { | ||
| name: 'app/files-to-ignore', | ||
| ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'], | ||
| }, | ||
| pluginVue.configs['flat/essential'], | ||
| vueTsConfigs.recommended, | ||
| { | ||
| ...pluginVitest.configs.recommended, | ||
| files: ['src/**/__tests__/*'], | ||
| }, | ||
| skipFormatting, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <!-- | ||
| * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| --> | ||
|
|
||
| <!doctype html> | ||
| <html lang=""> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <link rel="icon" href="/favicon.ico" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Vue Sample</title> | ||
| </head> | ||
| <body> | ||
| <div id="app"></div> | ||
| <script type="module" src="/src/main.ts"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "name": "vue-sample", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "vite", | ||
| "build": "run-p type-check \"build-only {@}\" --", | ||
| "preview": "vite preview", | ||
| "test:unit": "vitest", | ||
| "build-only": "vite build", | ||
| "type-check": "vue-tsc --build", | ||
| "lint": "eslint . --fix", | ||
| "format": "prettier --write src/" | ||
| }, | ||
| "dependencies": { | ||
| "vue": "^3.5.13", | ||
| "vue-router": "^4.5.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@tsconfig/node22": "^22.0.0", | ||
| "@types/jsdom": "^21.1.7", | ||
| "@types/node": "^22.13.4", | ||
| "@vitejs/plugin-vue": "^5.2.1", | ||
| "@vitest/eslint-plugin": "1.1.31", | ||
| "@vue/eslint-config-prettier": "^10.2.0", | ||
| "@vue/eslint-config-typescript": "^14.4.0", | ||
| "@vue/test-utils": "^2.4.6", | ||
| "@vue/tsconfig": "^0.7.0", | ||
| "eslint": "^9.20.1", | ||
| "eslint-plugin-vue": "^9.32.0", | ||
| "jiti": "^2.4.2", | ||
| "jsdom": "^26.0.0", | ||
| "npm-run-all2": "^7.0.2", | ||
| "prettier": "^3.5.1", | ||
| "typescript": "~5.7.3", | ||
| "vite": "^6.1.0", | ||
| "vite-plugin-vue-devtools": "^7.7.2", | ||
| "vitest": "^3.0.5", | ||
| "vue-tsc": "^2.2.2" | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's use asgardeo icon |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| <!-- | ||
| * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| --> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { RouterView } from 'vue-router' | ||
| </script> | ||
|
|
||
| <template> | ||
| <RouterView /> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| header { | ||
| line-height: 1.5; | ||
| max-height: 100vh; | ||
| } | ||
|
|
||
| .logo { | ||
| display: block; | ||
| margin: 0 auto 2rem; | ||
| } | ||
|
|
||
| nav { | ||
| width: 100%; | ||
| font-size: 12px; | ||
| text-align: center; | ||
| margin-top: 2rem; | ||
| } | ||
|
|
||
| nav a.router-link-exact-active { | ||
| color: var(--color-text); | ||
| } | ||
|
|
||
| nav a.router-link-exact-active:hover { | ||
| background-color: transparent; | ||
| } | ||
|
|
||
| nav a { | ||
| display: inline-block; | ||
| padding: 0 1rem; | ||
| border-left: 1px solid var(--color-border); | ||
| } | ||
|
|
||
| nav a:first-of-type { | ||
| border: 0; | ||
| } | ||
|
|
||
| @media (min-width: 1024px) { | ||
| header { | ||
| display: flex; | ||
| place-items: center; | ||
| padding-right: calc(var(--section-gap) / 2); | ||
| } | ||
|
|
||
| .logo { | ||
| margin: 0 2rem 0 0; | ||
| } | ||
|
|
||
| header .wrapper { | ||
| display: flex; | ||
| place-items: flex-start; | ||
| flex-wrap: wrap; | ||
| } | ||
|
|
||
| nav { | ||
| text-align: left; | ||
| margin-left: -1rem; | ||
| font-size: 1rem; | ||
|
|
||
| padding: 1rem 0; | ||
| margin-top: 1rem; | ||
| } | ||
| } | ||
| </style> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the TS version to workspace version