Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: policy and token checkout integration #46

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/qe-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:
quality-engineering:
name: QE
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14
with:
cypress: true
cyRunnerBranch: ${{ github.event.inputs.cyRunnerBranch }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qe-pull-request-target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
quality-engineering:
name: QE
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14
with:
danger: true
dangerRequireChangelog: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qe-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
quality-engineering:
name: QE
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14
with:
danger: true
dangerRequireChangelog: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qe-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
quality-engineering:
name: QE
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14
with:
nodeLint: true
nodeTest: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qe-schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
quality-engineering:
name: QE
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2
uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14
with:
cypress: true
cyRunnerTimeOut: 45
Expand Down
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](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Adjust the auth token and policies to update the order form when using the quote.

## [2.5.0] - 2023-12-15

### Added
Expand Down
10 changes: 7 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"vtex.b2b-organizations-graphql": "0.x",
"vtex.orders-broadcast": "0.x"
},
"registries": [
"smartcheckout"
],
"registries": ["smartcheckout"],
"policies": [
{
"name": "vbase-read-write"
Expand Down Expand Up @@ -132,6 +130,12 @@
"host": "rc.vtex.com",
"path": "/api/analytics/schemaless-events"
}
},
{
"name": "SaveOrderFormConfiguration"
},
{
"name": "AcessaTodosCarrinhos"
}
],
"$schema": "https://raw.githubusercontent.com/vtex/node-vtex-api/master/gen/manifest.schema"
Expand Down
4 changes: 2 additions & 2 deletions node/resolvers/mutations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export const Mutation = {
const {
clients: { masterdata, hub },
vtex,
vtex: { account, logger, storeUserAuthToken },
vtex: { account, logger, authToken },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between authToken and storeUserAuthToken? I'm afraid this change could break some use case that uses storeUserAuthToken

Copy link
Contributor Author

@Rudge Rudge Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main differences are here. If we use the store token, we need to give this permission to all shoppers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I think I got it. We are using the app token to communicate with checkout (instead of the user token), which in this case seems to make sense (due to the permission issue you mentioned)

} = ctx

const { sessionData, storefrontPermissions } = vtex as any
Expand All @@ -361,7 +361,7 @@ export const Mutation = {

const useHeaders = {
'Content-Type': 'application/json',
Cookie: `VtexIdclientAutCookie=${storeUserAuthToken};`,
Cookie: `VtexIdclientAutCookie=${authToken};`,
}

try {
Expand Down
Loading