{"_id":"@datyin/msal-vue","_rev":"1-309e920c6c14fc0765e3c473b996f2de","name":"@datyin/msal-vue","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@datyin/msal-vue","version":"1.0.0","keywords":["vue","msal","azure","@azure/msal","@azure/msal-browser","auth","auth-browser"],"author":{"url":"https://github.com/datyin","name":"Jove Jonovski","email":"jovejonovski@gmail.com"},"license":"MIT","_id":"@datyin/msal-vue@1.0.0","maintainers":[{"name":"thetyin","email":"jovejonovski@gmail.com"}],"homepage":"https://github.com/datyin/vue-msal#readme","bugs":{"url":"https://github.com/datyin/vue-msal/issues"},"dist":{"shasum":"7a593cca8f3ccaae306f54214ebe15b8cee29ba2","tarball":"https://registry.npmjs.org/@datyin/msal-vue/-/msal-vue-1.0.0.tgz","fileCount":9,"integrity":"sha512-1Arv4ylJUBlgIulbfyl6g5xxoaubC8NKjMKStqQg/O05ahmz89a40kcuzWXecoH+b06QDNf6KwutrQnQ9vlAWg==","signatures":[{"sig":"MEYCIQDjlMPIwwwQxhG+hFd+WyPPCpZDKw8hK28zlQSKJmzs7wIhAMmvzykewIq4N72KojnokK6RUIvPq6CRfJcmh9k0yMAF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12752},"main":"src/index.ts","type":"module","_from":"file:datyin-msal-vue-1.0.0.tgz","types":"src/index.ts","module":"src/index.ts","scripts":{"dev":"vite","lint":"eslint ./src","build":"pnpm run lint && pnpm run ts:check && vite build && pnpm run ts:dts","ts:dts":"vue-tsc -p tsconfig.build.json","lint:fix":"eslint ./src --fix","ts:check":"vue-tsc --noEmit","prepublish":"pnpm run build"},"_npmUser":{"name":"thetyin","email":"jovejonovski@gmail.com"},"_resolved":"C:\\Users\\Jove\\AppData\\Local\\Temp\\c2e7e28b6e3fe6bd29c7d21ad103812c\\datyin-msal-vue-1.0.0.tgz","_integrity":"sha512-1Arv4ylJUBlgIulbfyl6g5xxoaubC8NKjMKStqQg/O05ahmz89a40kcuzWXecoH+b06QDNf6KwutrQnQ9vlAWg==","repository":{"url":"git+https://github.com/datyin/vue-msal.git","type":"git","directory":"lib"},"_npmVersion":"10.8.0","description":"Microsoft Authentication Library for Vue","directories":{},"_nodeVersion":"18.19.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"vue":"^3.3.0","@azure/msal-browser":"^3.14.0"},"_npmOperationalInternal":{"tmp":"tmp/msal-vue_1.0.0_1717104110442_0.07564928624935363","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@datyin/msal-vue","type":"module","version":"1.0.1","description":"Microsoft Authentication Library for Vue","author":{"name":"Jove Jonovski","email":"jovejonovski@gmail.com","url":"https://github.com/datyin"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/datyin/vue-msal.git","directory":"lib"},"keywords":["vue","msal","azure","@azure/msal","@azure/msal-browser","auth","auth-browser"],"main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","peerDependencies":{"@azure/msal-browser":"^3.14.0","vue":"^3.3.0"},"publishConfig":{"access":"public"},"scripts":{"lint":"eslint ./src","lint:fix":"eslint ./src --fix","ts:check":"vue-tsc --noEmit","ts:dts":"vue-tsc -p tsconfig.build.json","dev":"vite","build":"pnpm run lint && pnpm run ts:check && vite build && pnpm run ts:dts","prepublish":"pnpm run build"},"_id":"@datyin/msal-vue@1.0.1","bugs":{"url":"https://github.com/datyin/vue-msal/issues"},"homepage":"https://github.com/datyin/vue-msal#readme","_integrity":"sha512-r7hSlnTSeFaJfgxG8UaJbXMLQXU0/SsyeovnVVFsaHrZSaG76PO/p0PWkLNKDz++wgNfJhVvB/PK36oXq1e0vg==","_resolved":"C:\\Users\\Jove\\AppData\\Local\\Temp\\c51e99522f9cb727fcff922684b21779\\datyin-msal-vue-1.0.1.tgz","_from":"file:datyin-msal-vue-1.0.1.tgz","_nodeVersion":"18.20.3","_npmVersion":"10.8.2","dist":{"integrity":"sha512-r7hSlnTSeFaJfgxG8UaJbXMLQXU0/SsyeovnVVFsaHrZSaG76PO/p0PWkLNKDz++wgNfJhVvB/PK36oXq1e0vg==","shasum":"7544b584b6ea75a6503e6373974ff1da804ea33b","tarball":"https://registry.npmjs.org/@datyin/msal-vue/-/msal-vue-1.0.1.tgz","fileCount":8,"unpackedSize":12666,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDhvuA3SSvkWJShDel2sVZCQCAxZIveEcy8VDQ1eSJN7wIgMxq7XxGBgSGwqZb8F8zed2kc6OUJ5/XnfHoxkpC6ADI="}]},"_npmUser":{"name":"thetyin","email":"jovejonovski@gmail.com"},"directories":{},"maintainers":[{"name":"thetyin","email":"jovejonovski@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/msal-vue_1.0.1_1723019272791_0.7841548818185116"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-30T21:21:50.320Z","modified":"2024-08-07T08:27:53.178Z","1.0.0":"2024-05-30T21:21:50.601Z","1.0.1":"2024-08-07T08:27:53.002Z"},"bugs":{"url":"https://github.com/datyin/vue-msal/issues"},"author":{"name":"Jove Jonovski","email":"jovejonovski@gmail.com","url":"https://github.com/datyin"},"license":"MIT","homepage":"https://github.com/datyin/vue-msal#readme","keywords":["vue","msal","azure","@azure/msal","@azure/msal-browser","auth","auth-browser"],"repository":{"type":"git","url":"git+https://github.com/datyin/vue-msal.git","directory":"lib"},"description":"Microsoft Authentication Library for Vue","maintainers":[{"name":"thetyin","email":"jovejonovski@gmail.com"}],"readme":"# Microsoft Authentication Library for Vue (msal-vue)\r\n\r\n## Installation\r\n\r\nThe MSAL Vue package is available on NPM.\r\n\r\n```sh\r\n# pnpm\r\npnpm add @datyin/msal-vue @azure/msal-browser vue\r\n\r\n# yarn\r\nyarn add @datyin/msal-vue @azure/msal-browser vue\r\n\r\n# or npm\r\nnpm install @datyin/msal-vue @azure/msal-browser vue\r\n```\r\n\r\n## Usage\r\n\r\n```vue\r\n<script setup lang=\"ts\">\r\nimport { ref } from \"vue\";\r\nimport { RouterView } from \"vue-router\";\r\nimport { MsalProvider } from \"@datyin/msal-vue\";\r\nimport type { AccountInfo } from \"@azure/msal-browser\";\r\nimport SplashScreen from \"./components/SplashScreen.vue\";\r\nimport { useUserStore } from \"./stores/user.ts\";\r\nimport { msalConfig } from \"./configs/msal.ts\";\r\n\r\nconst user = useUserStore();\r\nconst loading = ref(true);\r\n\r\nfunction handleAccountChanged(account: AccountInfo | null) {\r\n  user.update(account);\r\n}\r\n</script>\r\n\r\n<template>\r\n  <MsalProvider\r\n    :configuration=\"msalConfig\"\r\n    @initialized=\"() => loading = false\"\r\n    @account-changed=\"handleAccountChanged\"\r\n    @accounts-changed=\"(accounts) => console.debug('Accounts changed:', accounts)\"\r\n    @token-changed=\"(token) => console.debug('Token changed:', token)\"\r\n    @message=\"(message) => console.debug('Message:', message)\"\r\n    @dispose=\"() => console.debug('Disposed')\"\r\n  >\r\n    <SplashScreen v-if=\"loading\" />\r\n    <RouterView v-else />\r\n  </MsalProvider>\r\n</template>\r\n```\r\n\r\n### MsalProvider\r\n\r\nProps:\r\n\r\n- `configuration`: MSAL configuration object\r\n\r\nEvents:\r\n\r\n- `initialized`: Emitted when MSAL is initialized\r\n- `account-changed`: Emitted when the signed-in account changes\r\n- `accounts-changed`: Emitted when the list of signed-in accounts changes\r\n- `token-changed`: Emitted when the access token changes\r\n- `message`: Emitted when a event message is received from MSAL\r\n- `dispose`: Emitted before the component is destroyed\r\n\r\nProvider:\r\n\r\n- `msal`: MSAL instance (You can use inject method to access it in child components or use useMsal composable function)\r\n\r\n### useMsal\r\n\r\nuseMsal is a composable function that provides access to the MSAL instance. It can be used in vue components or other typescript/javascript files.\r\n\r\n```typescript\r\nimport { useMSAL } from \"@datyin/msal-vue\";\r\n\r\nexport function login() {\r\n  const msal = useMSAL();\r\n\r\n  if (msal) {\r\n    msal.loginRedirect({\r\n      scopes: [\r\n        \"user.read\",\r\n      ],\r\n    });\r\n  }\r\n}\r\n\r\nexport function logout() {\r\n  const msal = useMSAL();\r\n\r\n  if (msal) {\r\n    msal.logoutRedirect();\r\n  }\r\n}\r\n\r\n```\r\n\r\n## Samples\r\n\r\nSee [Sample](../sample/README.md) for a complete example.\r\n","readmeFilename":"README.md"}