Skip to content

Commit

Permalink
Merge pull request #64 from vtex-apps/fix/B2BTEAM-1520-app-name-check…
Browse files Browse the repository at this point in the history
…-permissions

fix: adjust app name to get permission and token header
  • Loading branch information
Rudge authored Dec 15, 2023
2 parents 232ee17 + 8be012c commit 86e70da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Adjust sender app name and token to call check user permission

## [1.11.0] - 2023-11-30

### Added
Expand Down
2 changes: 1 addition & 1 deletion node/clients/StorefrontPermissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class StorefrontPermissions extends AppGraphQLClient {
extensions: {
persistedQuery: {
provider: '[email protected]',
sender: 'vtex.b2b-organizations@0.x',
sender: 'vtex.b2b-checkout-settings@1.x',
},
},
query: QUERIES.getPermission,
Expand Down
11 changes: 9 additions & 2 deletions node/clients/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ export class Clients extends IOClients {
}

export const getTokenToHeader = (ctx: IOContext) => {
const token =
ctx.storeUserAuthToken ?? ctx.adminUserAuthToken ?? ctx.authToken

const { sessionToken } = ctx

return {
VtexIdclientAutCookie:
ctx.storeUserAuthToken ?? ctx.adminUserAuthToken ?? ctx.authToken,
'x-vtex-credential': ctx.authToken,
VtexIdclientAutCookie: token,
cookie: `VtexIdclientAutCookie=${token}`,
'x-vtex-session': sessionToken,
}
}

0 comments on commit 86e70da

Please sign in to comment.