@dotbots-boutique/auth-sdk 1.0.6 → 1.0.7

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/README.md CHANGED
@@ -115,7 +115,7 @@ App (frontend) → Local proxy (per server) → api.dotbots.ai
115
115
 
116
116
  During `initialize()`, the SDK fetches the proxy config from `GET {apiUrl}/api/proxy/config`. After that, all `auth.fetch()` calls are routed through the proxy automatically. If the proxy config cannot be fetched, the SDK falls back to direct communication with `apiUrl`.
117
117
 
118
- Auth endpoints (`/api/auth/*`) and the proxy config endpoint always go directly to `apiUrl` — never through the proxy.
118
+ Auth endpoints (`/auth/*`) and the proxy config endpoint always go directly to `apiUrl` — never through the proxy.
119
119
 
120
120
  ---
121
121
 
package/dist/cjs/index.js CHANGED
@@ -39,7 +39,7 @@ class TokenManager {
39
39
  throw new DotBotsAuthError('CODE_EXPIRED', 'No auth code provided');
40
40
  }
41
41
  console.warn(`[DotBotsAuth] Exchanging auth code: ${code.substring(0, 2)}**`);
42
- const response = await this.apiRequest('/api/auth/token', {
42
+ const response = await this.apiRequest('/auth/token', {
43
43
  method: 'POST',
44
44
  headers: { 'Content-Type': 'application/json' },
45
45
  body: JSON.stringify({ code, appId: this.config.appId }),
@@ -59,7 +59,7 @@ class TokenManager {
59
59
  }
60
60
  let response;
61
61
  try {
62
- response = await this.apiRequest('/api/auth/refresh', {
62
+ response = await this.apiRequest('/auth/refresh', {
63
63
  method: 'POST',
64
64
  headers: { 'Content-Type': 'application/json' },
65
65
  body: JSON.stringify({
@@ -80,7 +80,7 @@ class TokenManager {
80
80
  async revoke() {
81
81
  if (this.accessToken && this.refreshToken) {
82
82
  try {
83
- await this.apiRequest('/api/auth/revoke', {
83
+ await this.apiRequest('/auth/revoke', {
84
84
  method: 'POST',
85
85
  headers: {
86
86
  'Content-Type': 'application/json',
@@ -272,7 +272,7 @@ class DotBotsAuth {
272
272
  this.assertInitialized();
273
273
  if (this.cachedUser)
274
274
  return this.cachedUser;
275
- const response = await this.buildRequest(`${this.proxyConfigManager.getBaseUrl()}/api/auth/me`);
275
+ const response = await this.buildRequest(`${this.proxyConfigManager.getBaseUrl()}/auth/me`);
276
276
  if (!response.ok) {
277
277
  if (response.status === 401) {
278
278
  throw new DotBotsAuthError('UNAUTHORIZED', 'Not authorized to access this app');
@@ -329,7 +329,7 @@ class DotBotsAuth {
329
329
  }
330
330
  else {
331
331
  const redirectUri = encodeURIComponent(window.location.origin);
332
- window.location.href = `${this.config.apiUrl}/api/auth/logout?redirectUri=${redirectUri}`;
332
+ window.location.href = `${this.config.apiUrl}/auth/logout?redirectUri=${redirectUri}`;
333
333
  }
334
334
  }
335
335
  on(event, handler) {
@@ -377,7 +377,7 @@ class DotBotsAuth {
377
377
  else if (!this.tokenManager.isAuthenticated()) {
378
378
  // Redirect to auth
379
379
  const redirectUri = encodeURIComponent(window.location.href);
380
- window.location.href = `${this.config.apiUrl}/api/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
380
+ window.location.href = `${this.config.apiUrl}/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
381
381
  }
382
382
  }
383
383
  async buildRequest(url, options) {
@@ -409,7 +409,7 @@ class DotBotsAuth {
409
409
  }
410
410
  }
411
411
  }
412
- DotBotsAuth.SDK_VERSION = '1.0.6';
412
+ DotBotsAuth.SDK_VERSION = '1.0.7';
413
413
 
414
414
  exports.DotBotsAuth = DotBotsAuth;
415
415
  exports.DotBotsAuthError = DotBotsAuthError;
package/dist/esm/index.js CHANGED
@@ -37,7 +37,7 @@ class TokenManager {
37
37
  throw new DotBotsAuthError('CODE_EXPIRED', 'No auth code provided');
38
38
  }
39
39
  console.warn(`[DotBotsAuth] Exchanging auth code: ${code.substring(0, 2)}**`);
40
- const response = await this.apiRequest('/api/auth/token', {
40
+ const response = await this.apiRequest('/auth/token', {
41
41
  method: 'POST',
42
42
  headers: { 'Content-Type': 'application/json' },
43
43
  body: JSON.stringify({ code, appId: this.config.appId }),
@@ -57,7 +57,7 @@ class TokenManager {
57
57
  }
58
58
  let response;
59
59
  try {
60
- response = await this.apiRequest('/api/auth/refresh', {
60
+ response = await this.apiRequest('/auth/refresh', {
61
61
  method: 'POST',
62
62
  headers: { 'Content-Type': 'application/json' },
63
63
  body: JSON.stringify({
@@ -78,7 +78,7 @@ class TokenManager {
78
78
  async revoke() {
79
79
  if (this.accessToken && this.refreshToken) {
80
80
  try {
81
- await this.apiRequest('/api/auth/revoke', {
81
+ await this.apiRequest('/auth/revoke', {
82
82
  method: 'POST',
83
83
  headers: {
84
84
  'Content-Type': 'application/json',
@@ -270,7 +270,7 @@ class DotBotsAuth {
270
270
  this.assertInitialized();
271
271
  if (this.cachedUser)
272
272
  return this.cachedUser;
273
- const response = await this.buildRequest(`${this.proxyConfigManager.getBaseUrl()}/api/auth/me`);
273
+ const response = await this.buildRequest(`${this.proxyConfigManager.getBaseUrl()}/auth/me`);
274
274
  if (!response.ok) {
275
275
  if (response.status === 401) {
276
276
  throw new DotBotsAuthError('UNAUTHORIZED', 'Not authorized to access this app');
@@ -327,7 +327,7 @@ class DotBotsAuth {
327
327
  }
328
328
  else {
329
329
  const redirectUri = encodeURIComponent(window.location.origin);
330
- window.location.href = `${this.config.apiUrl}/api/auth/logout?redirectUri=${redirectUri}`;
330
+ window.location.href = `${this.config.apiUrl}/auth/logout?redirectUri=${redirectUri}`;
331
331
  }
332
332
  }
333
333
  on(event, handler) {
@@ -375,7 +375,7 @@ class DotBotsAuth {
375
375
  else if (!this.tokenManager.isAuthenticated()) {
376
376
  // Redirect to auth
377
377
  const redirectUri = encodeURIComponent(window.location.href);
378
- window.location.href = `${this.config.apiUrl}/api/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
378
+ window.location.href = `${this.config.apiUrl}/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
379
379
  }
380
380
  }
381
381
  async buildRequest(url, options) {
@@ -407,6 +407,6 @@ class DotBotsAuth {
407
407
  }
408
408
  }
409
409
  }
410
- DotBotsAuth.SDK_VERSION = '1.0.6';
410
+ DotBotsAuth.SDK_VERSION = '1.0.7';
411
411
 
412
412
  export { DotBotsAuth, DotBotsAuthError };
@@ -8,7 +8,7 @@ export declare class DotBotsAuth {
8
8
  private readonly listeners;
9
9
  private cachedUser;
10
10
  private initialized;
11
- static readonly SDK_VERSION = "1.0.6";
11
+ static readonly SDK_VERSION = "1.0.7";
12
12
  constructor(config: DotBotsConfig);
13
13
  initialize(): Promise<void>;
14
14
  getUser(): Promise<DotBotsUser>;
@@ -37,7 +37,7 @@ class TokenManager {
37
37
  throw new DotBotsAuthError('CODE_EXPIRED', 'No auth code provided');
38
38
  }
39
39
  console.warn(`[DotBotsAuth] Exchanging auth code: ${code.substring(0, 2)}**`);
40
- const response = await this.apiRequest('/api/auth/token', {
40
+ const response = await this.apiRequest('/auth/token', {
41
41
  method: 'POST',
42
42
  headers: { 'Content-Type': 'application/json' },
43
43
  body: JSON.stringify({ code, appId: this.config.appId }),
@@ -57,7 +57,7 @@ class TokenManager {
57
57
  }
58
58
  let response;
59
59
  try {
60
- response = await this.apiRequest('/api/auth/refresh', {
60
+ response = await this.apiRequest('/auth/refresh', {
61
61
  method: 'POST',
62
62
  headers: { 'Content-Type': 'application/json' },
63
63
  body: JSON.stringify({
@@ -78,7 +78,7 @@ class TokenManager {
78
78
  async revoke() {
79
79
  if (this.accessToken && this.refreshToken) {
80
80
  try {
81
- await this.apiRequest('/api/auth/revoke', {
81
+ await this.apiRequest('/auth/revoke', {
82
82
  method: 'POST',
83
83
  headers: {
84
84
  'Content-Type': 'application/json',
@@ -270,7 +270,7 @@ class DotBotsAuth {
270
270
  this.assertInitialized();
271
271
  if (this.cachedUser)
272
272
  return this.cachedUser;
273
- const response = await this.buildRequest(`${this.proxyConfigManager.getBaseUrl()}/api/auth/me`);
273
+ const response = await this.buildRequest(`${this.proxyConfigManager.getBaseUrl()}/auth/me`);
274
274
  if (!response.ok) {
275
275
  if (response.status === 401) {
276
276
  throw new DotBotsAuthError('UNAUTHORIZED', 'Not authorized to access this app');
@@ -327,7 +327,7 @@ class DotBotsAuth {
327
327
  }
328
328
  else {
329
329
  const redirectUri = encodeURIComponent(window.location.origin);
330
- window.location.href = `${this.config.apiUrl}/api/auth/logout?redirectUri=${redirectUri}`;
330
+ window.location.href = `${this.config.apiUrl}/auth/logout?redirectUri=${redirectUri}`;
331
331
  }
332
332
  }
333
333
  on(event, handler) {
@@ -375,7 +375,7 @@ class DotBotsAuth {
375
375
  else if (!this.tokenManager.isAuthenticated()) {
376
376
  // Redirect to auth
377
377
  const redirectUri = encodeURIComponent(window.location.href);
378
- window.location.href = `${this.config.apiUrl}/api/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
378
+ window.location.href = `${this.config.apiUrl}/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
379
379
  }
380
380
  }
381
381
  async buildRequest(url, options) {
@@ -407,6 +407,6 @@ class DotBotsAuth {
407
407
  }
408
408
  }
409
409
  }
410
- DotBotsAuth.SDK_VERSION = '1.0.6';
410
+ DotBotsAuth.SDK_VERSION = '1.0.7';
411
411
 
412
412
  export { DotBotsAuth, DotBotsAuthError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotbots-boutique/auth-sdk",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Authentication SDK for DotBots marketplace apps",
5
5
  "license": "MIT",
6
6
  "type": "module",