@emilgroup/partner-portal-sdk-node 1.0.1-beta.0 → 1.0.1-beta.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.
- package/README.md +2 -2
- package/api/intermediary-api.ts +112 -112
- package/base.ts +1 -1
- package/common.ts +2 -2
- package/configuration.ts +9 -0
- package/dist/api/intermediary-api.d.ts +112 -112
- package/dist/api/intermediary-api.js +71 -71
- package/dist/base.js +1 -1
- package/dist/common.js +2 -2
- package/dist/configuration.d.ts +6 -0
- package/dist/configuration.js +8 -0
- package/git_push.sh +1 -1
- package/package.json +1 -1
package/base.ts
CHANGED
|
@@ -225,7 +225,7 @@ export class BaseAPI {
|
|
|
225
225
|
const tokenString = await this.refreshTokenInternal();
|
|
226
226
|
const accessToken = `Bearer ${tokenString}`;
|
|
227
227
|
|
|
228
|
-
originalConfig.headers['Authorization'] =
|
|
228
|
+
originalConfig.headers['Authorization'] = accessToken;
|
|
229
229
|
|
|
230
230
|
this.configuration.accessToken = accessToken;
|
|
231
231
|
|
package/common.ts
CHANGED
|
@@ -66,7 +66,7 @@ export const setBearerAuthToObject = async function (object: any, configuration?
|
|
|
66
66
|
const accessToken = typeof configuration.accessToken === 'function'
|
|
67
67
|
? await configuration.accessToken()
|
|
68
68
|
: await configuration.accessToken;
|
|
69
|
-
object["Authorization"] =
|
|
69
|
+
object["Authorization"] = configuration.getBearerToken(accessToken);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -79,7 +79,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope
|
|
|
79
79
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
80
80
|
? await configuration.accessToken(name, scopes)
|
|
81
81
|
: await configuration.accessToken;
|
|
82
|
-
object["Authorization"] =
|
|
82
|
+
object["Authorization"] = configuration.getBearerToken(localVarAccessTokenValue);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
package/configuration.ts
CHANGED
|
@@ -106,4 +106,13 @@ export class Configuration {
|
|
|
106
106
|
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
107
107
|
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Returns "Bearer" token.
|
|
112
|
+
* @param token - access token.
|
|
113
|
+
* @return Bearer token.
|
|
114
|
+
*/
|
|
115
|
+
public getBearerToken(token?: string): string {
|
|
116
|
+
return ('' + token).startsWith("Bearer") ? token : "Bearer " + token;
|
|
117
|
+
}
|
|
109
118
|
}
|