@simonfestl/husky-cli 1.20.0 → 1.20.1
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/dist/commands/config.js +5 -3
- package/package.json +1 -1
package/dist/commands/config.js
CHANGED
|
@@ -77,11 +77,13 @@ export async function fetchAndCacheRole() {
|
|
|
77
77
|
// Session is active - fetch permissions for this session role if needed
|
|
78
78
|
// Check if we have fresh permissions for this session
|
|
79
79
|
const needsPermissionsFetch = !config.roleLastChecked || !config.permissions;
|
|
80
|
-
if (needsPermissionsFetch && config.apiUrl) {
|
|
80
|
+
if (needsPermissionsFetch && config.apiUrl && config.apiKey) {
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
// Fetch permissions for the session role using API key
|
|
83
|
+
// (Bearer tokens are not accepted by /api/auth/whoami)
|
|
84
|
+
const url = new URL(`/api/auth/permissions/${encodeURIComponent(config.sessionRole)}`, config.apiUrl);
|
|
83
85
|
const res = await fetch(url.toString(), {
|
|
84
|
-
headers: {
|
|
86
|
+
headers: { "x-api-key": config.apiKey },
|
|
85
87
|
});
|
|
86
88
|
if (res.ok) {
|
|
87
89
|
const data = await res.json();
|