@slavmak2486/bx24ts 1.2.21 → 1.2.22

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/BX24Server.ts CHANGED
@@ -165,7 +165,7 @@ export class BX24Server extends baseBX24{
165
165
 
166
166
  refreshAuthAsync():Promise<getAuth> {
167
167
  return new Promise((resolve, reject) => {
168
- this.call("https://oauth.bitrix.info/oauth/token/", {
168
+ this.call(`https://${this.OAUTH_DOMAIN}/oauth/token/`, {
169
169
  method:'refresh_token',
170
170
  data:{
171
171
  grant_type: 'refresh_token',
package/base/BX24.ts CHANGED
@@ -34,6 +34,8 @@ export abstract class baseBX24{
34
34
  CLIENT_ID: string | undefined="";
35
35
  CLIENT_SECRET: string | undefined="";
36
36
 
37
+ OAUTH_DOMAIN="oauth.bitrix24.tech";
38
+
37
39
  isInit=false;
38
40
  DOMAIN: string;
39
41
  PROTOCOL: number;
@@ -274,7 +276,7 @@ export abstract class baseBX24{
274
276
  if (!err?.response?.data){
275
277
  reject(err);
276
278
  }
277
- else if (__get(err, ['response','data','error'], undefined)=='expired_token'&&!url.includes('oauth.bitrix.info/oauth/token/')){
279
+ else if (__get(err, ['response','data','error'], undefined)=='expired_token'&&!url.includes(this.OAUTH_DOMAIN)){
278
280
  try {
279
281
  this.refreshAuth(()=>{
280
282
  this.call(url, config).then(resolve).catch(reject);
@@ -130,7 +130,7 @@ class BX24Server extends BX24_1.baseBX24 {
130
130
  }
131
131
  refreshAuthAsync() {
132
132
  return new Promise((resolve, reject) => {
133
- this.call("https://oauth.bitrix.info/oauth/token/", {
133
+ this.call(`https://${this.OAUTH_DOMAIN}/oauth/token/`, {
134
134
  method: 'refresh_token',
135
135
  data: {
136
136
  grant_type: 'refresh_token',
package/dist/base/BX24.js CHANGED
@@ -72,6 +72,7 @@ class baseBX24 {
72
72
  this.AUTH_CONNECTOR = "";
73
73
  this.CLIENT_ID = "";
74
74
  this.CLIENT_SECRET = "";
75
+ this.OAUTH_DOMAIN = "oauth.bitrix24.tech";
75
76
  this.isInit = false;
76
77
  this.APP_SID = false;
77
78
  this.PATH = "/rest";
@@ -241,7 +242,7 @@ class baseBX24 {
241
242
  if (!((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data)) {
242
243
  reject(err);
243
244
  }
244
- else if ((0, lodash_1.get)(err, ['response', 'data', 'error'], undefined) == 'expired_token' && !url.includes('oauth.bitrix.info/oauth/token/')) {
245
+ else if ((0, lodash_1.get)(err, ['response', 'data', 'error'], undefined) == 'expired_token' && !url.includes(this.OAUTH_DOMAIN)) {
245
246
  try {
246
247
  this.refreshAuth(() => {
247
248
  this.call(url, config).then(resolve).catch(reject);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slavmak2486/bx24ts",
3
- "version": "1.2.21",
3
+ "version": "1.2.22",
4
4
  "description": "Library for bitrix24",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",