younium-mcp 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/dist/auth.js +8 -13
  2. package/package.json +1 -1
package/dist/auth.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getToken = getToken;
4
- const TOKEN_URL = "https://auth.younium.com/connect/token";
5
- const REFRESH_BUFFER_SECS = 60;
4
+ const TOKEN_URL = "https://api.younium.com/auth/token";
5
+ const REFRESH_BUFFER_SECS = 300;
6
6
  let cached = null;
7
7
  function getEnv(name) {
8
8
  const val = process.env[name];
@@ -15,24 +15,19 @@ async function getToken() {
15
15
  if (cached && cached.expiresAt > now + REFRESH_BUFFER_SECS) {
16
16
  return cached.value;
17
17
  }
18
- const body = new URLSearchParams({
19
- grant_type: "password",
20
- scope: "youniumapi",
21
- username: getEnv("YOUNIUM_USERNAME"),
22
- password: getEnv("YOUNIUM_PASSWORD"),
23
- client_id: getEnv("YOUNIUM_CLIENT_ID"),
24
- client_secret: getEnv("YOUNIUM_CLIENT_SECRET"),
25
- });
26
18
  const res = await fetch(TOKEN_URL, {
27
19
  method: "POST",
28
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
29
- body: body.toString(),
20
+ headers: { "Content-Type": "application/json" },
21
+ body: JSON.stringify({
22
+ clientId: getEnv("YOUNIUM_CLIENT_ID"),
23
+ secret: getEnv("YOUNIUM_SECRET"),
24
+ }),
30
25
  });
31
26
  if (!res.ok) {
32
27
  const text = await res.text();
33
28
  throw new Error(`Younium auth failed (${res.status}): ${text}`);
34
29
  }
35
30
  const data = (await res.json());
36
- cached = { value: data.access_token, expiresAt: now + data.expires_in };
31
+ cached = { value: data.accessToken, expiresAt: now + data.expiresIn };
37
32
  return cached.value;
38
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "younium-mcp",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "MCP server for the Younium subscription management API",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/index.js",