@wix/api-client
Advanced tools
Comparing version 1.1.39 to 1.1.40
@@ -121,3 +121,3 @@ "use strict"; | ||
}); | ||
return { | ||
const tokens = { | ||
accessToken: (0, _tokenHelpers.createAccessToken)(tokensResponse.accessToken, tokensResponse.expiresIn), | ||
@@ -128,3 +128,31 @@ refreshToken: { | ||
}; | ||
setTokens(tokens); | ||
wixClientWithTokens.setHeaders({ | ||
Authorization: tokens.accessToken.value | ||
}); | ||
return tokens; | ||
}; | ||
const logout = async (refreshToken, redirectUrl) => { | ||
_tokens.accessToken = { | ||
value: '', | ||
expiresAt: 0 | ||
}; | ||
_tokens.refreshToken = { | ||
value: '' | ||
}; | ||
await wixClient.oauth.revokeRefreshToken({ | ||
token: refreshToken.value | ||
}); | ||
const { | ||
redirectSession | ||
} = await wixClientWithTokens.redirects.createRedirectSession({ | ||
logout: {}, | ||
callbacks: { | ||
postFlowUrl: redirectUrl | ||
} | ||
}); | ||
return { | ||
url: redirectSession.fullUrl | ||
}; | ||
}; | ||
return { | ||
@@ -151,5 +179,6 @@ generateVisitorTokens, | ||
setTokens, | ||
getTokens: () => _tokens | ||
getTokens: () => _tokens, | ||
logout | ||
}; | ||
} | ||
//# sourceMappingURL=OAuthStrategy.js.map |
@@ -116,3 +116,3 @@ import { createClient } from '../wixClient'; | ||
}); | ||
return { | ||
const tokens = { | ||
accessToken: createAccessToken(tokensResponse.accessToken, tokensResponse.expiresIn), | ||
@@ -123,3 +123,31 @@ refreshToken: { | ||
}; | ||
setTokens(tokens); | ||
wixClientWithTokens.setHeaders({ | ||
Authorization: tokens.accessToken.value | ||
}); | ||
return tokens; | ||
}; | ||
const logout = async (refreshToken, redirectUrl) => { | ||
_tokens.accessToken = { | ||
value: '', | ||
expiresAt: 0 | ||
}; | ||
_tokens.refreshToken = { | ||
value: '' | ||
}; | ||
await wixClient.oauth.revokeRefreshToken({ | ||
token: refreshToken.value | ||
}); | ||
const { | ||
redirectSession | ||
} = await wixClientWithTokens.redirects.createRedirectSession({ | ||
logout: {}, | ||
callbacks: { | ||
postFlowUrl: redirectUrl | ||
} | ||
}); | ||
return { | ||
url: redirectSession.fullUrl | ||
}; | ||
}; | ||
return { | ||
@@ -146,5 +174,6 @@ generateVisitorTokens, | ||
setTokens, | ||
getTokens: () => _tokens | ||
getTokens: () => _tokens, | ||
logout | ||
}; | ||
} | ||
//# sourceMappingURL=OAuthStrategy.js.map |
@@ -30,2 +30,5 @@ export interface Tokens { | ||
getMemberTokens: (query: string, state: OauthRedirectState) => Promise<Tokens>; | ||
logout: (refreshToken: RefreshToken, redirectUrl: string) => Promise<{ | ||
url: string; | ||
}>; | ||
} | ||
@@ -32,0 +35,0 @@ export declare function OAuthStrategy(config: { |
{ | ||
"name": "@wix/api-client", | ||
"version": "1.1.39", | ||
"version": "1.1.40", | ||
"license": "UNLICENSED", | ||
@@ -34,4 +34,4 @@ "author": { | ||
"@wix/redirects-api": "^1.0.18", | ||
"@wix/sdk-types": "^1.1.39", | ||
"pkce-challenge": "^3.0.0", | ||
"@wix/sdk-types": "^1.1.40", | ||
"pkce-challenge": "^3.1.0", | ||
"querystring": "^0.2.1", | ||
@@ -42,4 +42,4 @@ "type-fest": "^2.19.0" | ||
"@types/jest": "^27.5.2", | ||
"@types/node": "^16.18.20", | ||
"@wix/ecom": "^1.0.138", | ||
"@types/node": "^16.18.23", | ||
"@wix/ecom": "^1.0.139", | ||
"@wix/events": "^1.0.70", | ||
@@ -75,3 +75,3 @@ "@wix/jest-yoshi-preset": "^6.53.0", | ||
}, | ||
"falconPackageHash": "d6425ff3444e28e7baf4fdf64d8e5856fbfff576864b4ed497808fb4" | ||
"falconPackageHash": "8d3263844808d08c8d4437218f71296df72537fdaa65843ad170d658" | ||
} |
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
180643
1015
Updated@wix/sdk-types@^1.1.40
Updatedpkce-challenge@^3.1.0