@wix/api-client
Advanced tools
Comparing version 1.1.58 to 1.1.59
@@ -80,4 +80,4 @@ "use strict"; | ||
body: JSON.stringify({ | ||
grantType: 'refresh_token', | ||
refreshToken: 'something' | ||
refreshToken: 'something', | ||
grantType: 'refresh_token' | ||
}) | ||
@@ -135,4 +135,4 @@ })); | ||
body: JSON.stringify({ | ||
grantType: 'refresh_token', | ||
refreshToken: refreshToken.value | ||
refreshToken: refreshToken.value, | ||
grantType: 'refresh_token' | ||
}) | ||
@@ -163,4 +163,4 @@ })); | ||
body: JSON.stringify({ | ||
grantType: 'refresh_token', | ||
refreshToken: 'some-refreshToken' | ||
refreshToken: 'some-refreshToken', | ||
grantType: 'refresh_token' | ||
}) | ||
@@ -167,0 +167,0 @@ })); |
@@ -7,6 +7,6 @@ "use strict"; | ||
var _wixClient = require("../wixClient"); | ||
var _identity = require("@wix/identity"); | ||
var _redirects = require("@wix/redirects"); | ||
var _tokenHelpers = require("../tokenHelpers"); | ||
var _pkceChallenge = _interopRequireDefault(require("pkce-challenge")); | ||
var _common = require("../common"); | ||
const moduleWithTokens = { | ||
@@ -16,8 +16,2 @@ redirects: _redirects.redirects | ||
function OAuthStrategy(config) { | ||
const wixClient = (0, _wixClient.createClient)({ | ||
modules: { | ||
oauth: _identity.oauth, | ||
redirects: _redirects.redirects | ||
} | ||
}); | ||
const _tokens = config.tokens || { | ||
@@ -60,3 +54,3 @@ accessToken: { | ||
} | ||
const tokensResponse = await wixClient.oauth.token({ | ||
const tokensResponse = await getTokens({ | ||
clientId: config.clientId, | ||
@@ -73,3 +67,3 @@ grantType: 'anonymous' | ||
const renewToken = async refreshToken => { | ||
const tokensResponse = await wixClient.oauth.token({ | ||
const tokensResponse = await getTokens({ | ||
refreshToken: refreshToken.value, | ||
@@ -136,3 +130,3 @@ grantType: 'refresh_token' | ||
} | ||
const tokensResponse = await wixClient.oauth.token({ | ||
const tokensResponse = await getTokens({ | ||
clientId: config.clientId, | ||
@@ -187,2 +181,9 @@ grantType: 'authorization_code', | ||
} | ||
const getTokens = async payload => { | ||
const res = await fetch(`https://${_common.API_URL}/oauth2/token`, { | ||
method: 'POST', | ||
body: JSON.stringify(payload) | ||
}); | ||
return res.json(); | ||
}; | ||
//# sourceMappingURL=OAuthStrategy.js.map |
"use strict"; | ||
exports.__esModule = true; | ||
exports.PUBLIC_METADATA_KEY = void 0; | ||
exports.PUBLIC_METADATA_KEY = exports.API_URL = void 0; | ||
const PUBLIC_METADATA_KEY = '__metadata'; | ||
exports.PUBLIC_METADATA_KEY = PUBLIC_METADATA_KEY; | ||
const API_URL = 'www.wixapis.com'; | ||
exports.API_URL = API_URL; | ||
//# sourceMappingURL=common.js.map |
@@ -7,3 +7,2 @@ "use strict"; | ||
var _common = require("./common"); | ||
const API_URL = 'www.wixapis.com'; | ||
const wrapperBuilder = (origFunc, authStrategy, headers, publicMetadata | ||
@@ -15,5 +14,5 @@ // @ts-expect-error | ||
const requestOptions = factory({ | ||
host: API_URL | ||
host: _common.API_URL | ||
}); | ||
let url = `https://${API_URL}${requestOptions.url}`; | ||
let url = `https://${_common.API_URL}${requestOptions.url}`; | ||
if (requestOptions.params && requestOptions.params.toString()) { | ||
@@ -20,0 +19,0 @@ url += `?${requestOptions.params.toString()}`; |
@@ -78,4 +78,4 @@ import { cart } from '@wix/ecom'; | ||
body: JSON.stringify({ | ||
grantType: 'refresh_token', | ||
refreshToken: 'something' | ||
refreshToken: 'something', | ||
grantType: 'refresh_token' | ||
}) | ||
@@ -133,4 +133,4 @@ })); | ||
body: JSON.stringify({ | ||
grantType: 'refresh_token', | ||
refreshToken: refreshToken.value | ||
refreshToken: refreshToken.value, | ||
grantType: 'refresh_token' | ||
}) | ||
@@ -161,4 +161,4 @@ })); | ||
body: JSON.stringify({ | ||
grantType: 'refresh_token', | ||
refreshToken: 'some-refreshToken' | ||
refreshToken: 'some-refreshToken', | ||
grantType: 'refresh_token' | ||
}) | ||
@@ -165,0 +165,0 @@ })); |
import { createClient } from '../wixClient'; | ||
import { oauth } from '@wix/identity'; | ||
import { redirects } from '@wix/redirects'; | ||
import { createAccessToken, isTokenExpired } from '../tokenHelpers'; | ||
import pkceChallenge from 'pkce-challenge'; | ||
import { API_URL } from '../common'; | ||
const moduleWithTokens = { | ||
@@ -10,8 +10,2 @@ redirects | ||
export function OAuthStrategy(config) { | ||
const wixClient = createClient({ | ||
modules: { | ||
oauth, | ||
redirects | ||
} | ||
}); | ||
const _tokens = config.tokens || { | ||
@@ -54,3 +48,3 @@ accessToken: { | ||
} | ||
const tokensResponse = await wixClient.oauth.token({ | ||
const tokensResponse = await getTokens({ | ||
clientId: config.clientId, | ||
@@ -67,3 +61,3 @@ grantType: 'anonymous' | ||
const renewToken = async refreshToken => { | ||
const tokensResponse = await wixClient.oauth.token({ | ||
const tokensResponse = await getTokens({ | ||
refreshToken: refreshToken.value, | ||
@@ -130,3 +124,3 @@ grantType: 'refresh_token' | ||
} | ||
const tokensResponse = await wixClient.oauth.token({ | ||
const tokensResponse = await getTokens({ | ||
clientId: config.clientId, | ||
@@ -181,2 +175,9 @@ grantType: 'authorization_code', | ||
} | ||
const getTokens = async payload => { | ||
const res = await fetch("https://" + API_URL + "/oauth2/token", { | ||
method: 'POST', | ||
body: JSON.stringify(payload) | ||
}); | ||
return res.json(); | ||
}; | ||
//# sourceMappingURL=OAuthStrategy.js.map |
export const PUBLIC_METADATA_KEY = '__metadata'; | ||
export const API_URL = 'www.wixapis.com'; | ||
//# sourceMappingURL=common.js.map |
import { biHeaderGenerator } from './bi/biHeaderGenerator'; | ||
import { PUBLIC_METADATA_KEY } from './common'; | ||
const API_URL = 'www.wixapis.com'; | ||
import { PUBLIC_METADATA_KEY, API_URL } from './common'; | ||
const wrapperBuilder = (origFunc, authStrategy, headers, publicMetadata | ||
@@ -5,0 +4,0 @@ // @ts-expect-error |
@@ -5,2 +5,3 @@ export declare const PUBLIC_METADATA_KEY = "__metadata"; | ||
}; | ||
export declare const API_URL = "www.wixapis.com"; | ||
//# sourceMappingURL=common.d.ts.map |
{ | ||
"name": "@wix/api-client", | ||
"version": "1.1.58", | ||
"version": "1.1.59", | ||
"license": "UNLICENSED", | ||
@@ -31,6 +31,6 @@ "author": { | ||
"@babel/runtime": "^7.21.0", | ||
"@wix/identity": "^1.0.27", | ||
"@wix/identity": "^1.0.30", | ||
"@wix/image-kit": "^1.31.0", | ||
"@wix/redirects": "^1.0.8", | ||
"@wix/sdk-types": "1.1.58", | ||
"@wix/sdk-types": "1.1.59", | ||
"pkce-challenge": "^3.1.0", | ||
@@ -74,3 +74,3 @@ "querystring": "^0.2.1", | ||
}, | ||
"falconPackageHash": "47984b13b50a8b66363af00162aac5c91aa17c0d103fa4296b049f6a" | ||
"falconPackageHash": "daab6b5b26fe1ae6661cfc165902ba33250778e8fbe061a77d018ff1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
357785
2638
4
+ Added@wix/sdk-types@1.1.59(transitive)
- Removed@wix/sdk-types@1.1.58(transitive)
Updated@wix/identity@^1.0.30
Updated@wix/sdk-types@1.1.59