@snokam/auth 1.1.3 → 1.1.4
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/CHANGELOG.md +12 -0
- package/lib/client.d.ts +2 -3
- package/lib/client.js +1 -1
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +1 -2
- package/package.json +3 -3
- package/lib/token.d.ts +0 -2
- package/lib/token.js +0 -2
- package/lib/token.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.4](https://github.com/snokam/components/compare/@snokam/auth@1.1.3...@snokam/auth@1.1.4) (2024-07-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* rewrite library to use typescript-fetch! ([e7bb8aa](https://github.com/snokam/components/commit/e7bb8aa8c8638bd8869589ea0d5c3364d451cf60))
|
|
12
|
+
* types ([3c20479](https://github.com/snokam/components/commit/3c20479f4330878edc9144b28739c4b3bc53874c))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## [1.1.3](https://github.com/snokam/components/compare/@snokam/auth@1.1.2...@snokam/auth@1.1.3) (2024-07-17)
|
|
7
19
|
|
|
8
20
|
|
package/lib/client.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { Configuration
|
|
2
|
-
export {
|
|
3
|
-
export type { Configuration };
|
|
1
|
+
import { Configuration } from "@snokam/employees-client";
|
|
2
|
+
export { Configuration };
|
package/lib/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.snokam=o():e.snokam=o()}(this,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.snokam=o():e.snokam=o()}(this,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{Configuration:()=>t.Configuration});const t=require("@snokam/employees-client");return o})()));
|
|
2
2
|
//# sourceMappingURL=client.js.map
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,
|
|
1
|
+
{"version":3,"file":"client.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,uDCL9D,MAAM,EAA+BC,QAAQ,4B","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/external commonjs \"@snokam/employees-client\""],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@snokam/employees-client\");"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require"],"sourceRoot":""}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { AuthProps } from "./types";
|
|
|
2
2
|
import { Configuration } from "./client";
|
|
3
3
|
export type { AuthProps, Configuration };
|
|
4
4
|
export declare const useClient: (props: AuthProps) => {
|
|
5
|
-
getToken: () => Promise<any>;
|
|
6
5
|
configuration: Configuration;
|
|
6
|
+
getToken: (scopes?: string[]) => Promise<any>;
|
|
7
7
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={689:(e,t,o)=>{o.d(t,{
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={689:(e,t,o)=>{o.d(t,{Configuration:()=>n.Configuration});const n=require("@snokam/employees-client")}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{useClient:()=>c});const r=require("@azure/msal-react");var a=o(689);const c=e=>{const{basePath:t,withAuth:o}=e,{instance:n}=(0,r.useMsal)(),c=n.getAllAccounts()[0],i=e=>{return t=void 0,o=void 0,a=function*(){return n.acquireTokenSilent({scopes:e||[],account:c}).then((({accessToken:e})=>`Bearer ${e}`)).catch((e=>{throw console.error(e),e}))},new((r=void 0)||(r=Promise))((function(e,n){function c(e){try{s(a.next(e))}catch(e){n(e)}}function i(e){try{s(a.throw(e))}catch(e){n(e)}}function s(t){var o;t.done?e(t.value):(o=t.value,o instanceof r?o:new r((function(e){e(o)}))).then(c,i)}s((a=a.apply(t,o||[])).next())}));var t,o,r,a};return{configuration:new a.Configuration(Object.assign({basePath:t},o&&{accessToken:(e,t)=>i(t)})),getToken:i}};return n})()));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,G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BqBC,OAgBX,EAhBoBC,OAgBZ,EAhB2BC,EAgBX,YAC3D,OAAOT,EACFU,mBAAmB,CACpBL,OAAQA,GAAU,GAClBH,QAASA,IAERS,MAAK,EAAGC,iBAAkB,UAAUA,MACpCC,OAAOC,IAER,MADAC,QAAQD,MAAMA,GACRA,CAAK,GAEnB,EAzBO,KAFgEE,OAgBhB,KAdrCA,EAAIC,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUzB,GAAS,IAAM0B,EAAKZ,EAAUa,KAAK3B,GAAS,CAAE,MAAO4B,GAAKJ,EAAOI,EAAI,CAAE,CAC1F,SAASC,EAAS7B,GAAS,IAAM0B,EAAKZ,EAAiB,MAAEd,GAAS,CAAE,MAAO4B,GAAKJ,EAAOI,EAAI,CAAE,CAC7F,SAASF,EAAKI,GAJlB,IAAe9B,EAIa8B,EAAOC,KAAOR,EAAQO,EAAO9B,QAJ1CA,EAIyD8B,EAAO9B,MAJhDA,aAAiBqB,EAAIrB,EAAQ,IAAIqB,GAAE,SAAUE,GAAWA,EAAQvB,EAAQ,KAIjBgB,KAAKS,EAAWI,EAAW,CAC7GH,GAAMZ,EAAYA,EAAUkB,MAAMpB,EAASC,GAAc,KAAKc,OAClE,IAPwC,IAAUf,EAASC,EAAYQ,EAAGP,CA2BxE,EAKF,MAAO,CACHmB,cAJkB,IAAI,EAAAC,cAAc9C,OAAO+C,OAAO,CAAEhC,YAAaC,GAAY,CAC7Ea,YAAa,CAACmB,EAAG1B,IAAWD,EAASC,MAIrCD,WACH,E","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/external commonjs \"@snokam/employees-client\"","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/external commonjs \"@azure/msal-react\"","webpack://snokam/./src/index.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@snokam/employees-client\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@azure/msal-react\");","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { useMsal } from \"@azure/msal-react\";\nimport { Configuration } from \"./client\";\nexport const useClient = (props) => {\n const { basePath, withAuth } = props;\n const { instance } = useMsal();\n const account = instance.getAllAccounts()[0];\n // Fetch token from Azure Entra\n const getToken = (scopes) => __awaiter(void 0, void 0, void 0, function* () {\n return instance\n .acquireTokenSilent({\n scopes: scopes || [],\n account: account,\n })\n .then(({ accessToken }) => `Bearer ${accessToken}`)\n .catch((error) => {\n console.error(error);\n throw error;\n });\n });\n // Create configuration for Snøkam clients\n const configuration = new Configuration(Object.assign({ basePath }, (withAuth && {\n accessToken: (_, scopes) => getToken(scopes),\n })));\n return {\n configuration,\n getToken,\n };\n};\n"],"names":["root","factory","exports","module","define","amd","this","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","useClient","props","basePath","withAuth","instance","useMsal","account","getAllAccounts","getToken","scopes","__awaiter","thisArg","_arguments","generator","acquireTokenSilent","then","accessToken","catch","error","console","P","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","apply","configuration","Configuration","assign","_"],"sourceRoot":""}
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snokam/auth",
|
|
3
3
|
"description": "Utility functions for authentication",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@azure/msal-react": "^2.0.21",
|
|
28
|
-
"@snokam/employees-client": "^1.0.
|
|
28
|
+
"@snokam/employees-client": "^1.0.4"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "ceb2a9f36b1ca536e44862271831e9223defe97c"
|
|
31
31
|
}
|
package/lib/token.d.ts
DELETED
package/lib/token.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{useGetToken:()=>n});const o=require("@azure/msal-react");const n=({scopes:e})=>{const{instance:t}=(0,o.useMsal)(),n=t.getAllAccounts()[0];return()=>{return o=void 0,r=void 0,i=function*(){if(!n)throw new Error("No active account found.");try{const{accessToken:o}=yield t.acquireTokenSilent({scopes:e,account:n});return o}catch(e){throw console.warn("Failed to acquire token silently",e),e}},new((c=void 0)||(c=Promise))((function(e,t){function n(e){try{u(i.next(e))}catch(e){t(e)}}function a(e){try{u(i.throw(e))}catch(e){t(e)}}function u(t){var o;t.done?e(t.value):(o=t.value,o instanceof c?o:new c((function(e){e(o)}))).then(n,a)}u((i=i.apply(o,r||[])).next())}));var o,r,c,i}};return t})()));
|
|
2
|
-
//# sourceMappingURL=token.js.map
|
package/lib/token.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GA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AQO,EAAO3B,QAJ1CA,EAIyD2B,EAAO3B,MAJhDA,aAAiBkB,EAAIlB,EAAQ,IAAIkB,GAAE,SAAUE,GAAWA,EAAQpB,EAAQ,KAIjB6B,KAAKP,EAAWI,EAAW,CAC7GH,GAAMZ,EAAYA,EAAUmB,MAAMrB,EAASC,GAAc,KAAKc,OAClE,IAPwC,IAAUf,EAASC,EAAYQ,EAAGP,CA4BxE,G","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/external commonjs \"@azure/msal-react\"","webpack://snokam/./src/token.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@azure/msal-react\");","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { useMsal } from \"@azure/msal-react\";\nexport const useGetToken = ({ scopes }) => {\n const { instance } = useMsal();\n const account = instance.getAllAccounts()[0];\n return () => __awaiter(void 0, void 0, void 0, function* () {\n if (!account) {\n throw new Error(\"No active account found.\");\n }\n try {\n const { accessToken } = yield instance.acquireTokenSilent({\n scopes,\n account,\n });\n return accessToken;\n }\n catch (error) {\n console.warn(\"Failed to acquire token silently\", error);\n throw error;\n }\n });\n};\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","useGetToken","scopes","instance","useMsal","account","getAllAccounts","__awaiter","thisArg","_arguments","generator","Error","accessToken","acquireTokenSilent","error","console","warn","P","Promise","resolve","reject","fulfilled","step","next","e","rejected","result","done","then","apply"],"sourceRoot":""}
|