From 8726591528508678d18660bdb72a1fabeb495c88 Mon Sep 17 00:00:00 2001 From: Rogier Reerink Date: Thu, 8 Oct 2026 18:47:37 +0200 Subject: [PATCH] Store secrets in PM vault. --- .../Expenses Server/.resources/definition.yaml | 15 +-------------- .../API/Auth/Token/Refresh token.request.yaml | 6 +++--- ...st token using client credentials.request.yaml | 8 ++++---- .../API/Auth/Token/Revoke token.request.yaml | 2 +- .../Users/Apps/Secrets/Upsert secret.request.yaml | 2 +- .../API/Users/Apps/Upsert app.request.yaml | 2 +- 6 files changed, 11 insertions(+), 24 deletions(-) diff --git a/postman/collections/Expenses Server/.resources/definition.yaml b/postman/collections/Expenses Server/.resources/definition.yaml index 1872ed5..f723ea9 100644 --- a/postman/collections/Expenses Server/.resources/definition.yaml +++ b/postman/collections/Expenses Server/.resources/definition.yaml @@ -1,18 +1,5 @@ $kind: collection -variables: - - key: user_app_id - secret: true - disabled: false - - key: user_app_secret - secret: true - disabled: false - - key: access_token - secret: true - disabled: false - - key: refresh_token - secret: true - disabled: false auth: type: bearer credentials: - token: "{{access_token}}" + token: "{{vault:expenses_access_token}}" diff --git a/postman/collections/Expenses Server/API/Auth/Token/Refresh token.request.yaml b/postman/collections/Expenses Server/API/Auth/Token/Refresh token.request.yaml index 8b9361d..d20baaa 100644 --- a/postman/collections/Expenses Server/API/Auth/Token/Refresh token.request.yaml +++ b/postman/collections/Expenses Server/API/Auth/Token/Refresh token.request.yaml @@ -5,16 +5,16 @@ body: type: urlencoded content: grant_type: refresh_token - refresh_token: "{{refresh_token}}" + refresh_token: "{{vault:expenses_refresh_token}}" auth: type: noauth scripts: - type: afterResponse code: |- var access_token = pm.response.json()["access_token"]; - pm.collectionVariables.set("access_token", access_token); + await pm.vault.set("expenses_access_token", access_token); var refresh_token = pm.response.json()["refresh_token"]; - pm.collectionVariables.set("refresh_token", refresh_token); + await pm.vault.set("expenses_refresh_token", refresh_token); language: text/javascript order: 2000 diff --git a/postman/collections/Expenses Server/API/Auth/Token/Request token using client credentials.request.yaml b/postman/collections/Expenses Server/API/Auth/Token/Request token using client credentials.request.yaml index 30f97f8..df64d9c 100644 --- a/postman/collections/Expenses Server/API/Auth/Token/Request token using client credentials.request.yaml +++ b/postman/collections/Expenses Server/API/Auth/Token/Request token using client credentials.request.yaml @@ -5,17 +5,17 @@ body: type: urlencoded content: grant_type: client_credentials - client_id: "{{user_app_id}}" - client_secret: "{{user_app_secret}}" + client_id: "{{vault:expenses_user_app_id}}" + client_secret: "{{vault:expenses_user_app_secret}}" auth: type: noauth scripts: - type: afterResponse code: |- var access_token = pm.response.json()["access_token"]; - pm.collectionVariables.set("access_token", access_token); + await pm.vault.set("expenses_access_token", access_token); var refresh_token = pm.response.json()["refresh_token"]; - pm.collectionVariables.set("refresh_token", refresh_token); + await pm.vault.set("expenses_refresh_token", refresh_token); language: text/javascript order: 1000 diff --git a/postman/collections/Expenses Server/API/Auth/Token/Revoke token.request.yaml b/postman/collections/Expenses Server/API/Auth/Token/Revoke token.request.yaml index 32325fd..eba6325 100644 --- a/postman/collections/Expenses Server/API/Auth/Token/Revoke token.request.yaml +++ b/postman/collections/Expenses Server/API/Auth/Token/Revoke token.request.yaml @@ -4,7 +4,7 @@ method: POST body: type: urlencoded content: - token: "{{refresh_token}}" + token: "{{vault:refresh_token}}" auth: type: noauth order: 3000 diff --git a/postman/collections/Expenses Server/API/Users/Apps/Secrets/Upsert secret.request.yaml b/postman/collections/Expenses Server/API/Users/Apps/Secrets/Upsert secret.request.yaml index 9d4fc04..9238139 100644 --- a/postman/collections/Expenses Server/API/Users/Apps/Secrets/Upsert secret.request.yaml +++ b/postman/collections/Expenses Server/API/Users/Apps/Secrets/Upsert secret.request.yaml @@ -11,6 +11,6 @@ scripts: - type: afterResponse code: |- var user_app_secret = pm.response.json()["secret"]; - pm.collectionVariables.set("user_app_secret", user_app_secret); + await pm.vault.set("expenses_user_app_secret", user_app_secret); language: text/javascript order: 3000 diff --git a/postman/collections/Expenses Server/API/Users/Apps/Upsert app.request.yaml b/postman/collections/Expenses Server/API/Users/Apps/Upsert app.request.yaml index 1c71dae..8db60da 100644 --- a/postman/collections/Expenses Server/API/Users/Apps/Upsert app.request.yaml +++ b/postman/collections/Expenses Server/API/Users/Apps/Upsert app.request.yaml @@ -8,6 +8,6 @@ scripts: - type: afterResponse code: |- var user_app_id = pm.response.json()["id"]; - pm.collectionVariables.set("user_app_id", user_app_id); + await pm.vault.set("expenses_user_app_id", user_app_id); language: text/javascript order: 4000