Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(commercetools): fix password reset and improve server api (#6411)
* Given fewer permissions to Server API * Fix password reset permissions and allow custom operations in Server API * Update * Add migration guide
- Loading branch information
1 parent
5abcc41
commit 965c5e9
Showing
6 changed files
with
95 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Upgrading to 1.3.3 | ||
|
||
## Introduction | ||
|
||
In the 1.3.3 release, we added new options to the `serverApi` introduced in the 1.3.2 release. | ||
|
||
## Changes | ||
|
||
In the 1.3.2 release, we introduced a new key named `serverApi` to the commercetools middleware configuration. It stores API client used to generate access tokens for selected operations. However, we quickly noticed the need to allow adding other operations that will use these access tokens. That's why in this release we added new `operations` option to the `serverApi` configuration. | ||
|
||
```javascript{9-15} | ||
// middleware.config.js | ||
module.exports = { | ||
integrations: { | ||
ct: { | ||
location: '@vue-storefront/commercetools-api/server', | ||
configuration: { | ||
// irrelevant configuration was omitted for readability | ||
serverApi: { | ||
clientId: 'SERVER_ID', | ||
clientSecret: 'SERVER_SECRET', | ||
scopes: [ | ||
'manage_customers:PROJECT_KEY', | ||
'manage_products:PROJECT_KEY' | ||
], | ||
operations: [] | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
``` | ||
|
||
:::warning Custom operations might require additional scopes | ||
Remember that custom operations added to the `operations` array might require additional scopes. | ||
::: | ||
|
||
|
||
### Example | ||
|
||
Let's assume you have custom GraphQL that adds new mutation like shown below: | ||
|
||
```graphql | ||
mutation AddProductType( | ||
$draft: ProductTypeDraft! | ||
) { | ||
productType: createProductType(draft: $draft) { | ||
name | ||
description | ||
key | ||
} | ||
} | ||
``` | ||
|
||
In this case, you need to add `createProductType` to the `operations` array: | ||
|
||
```javascript{9-11} | ||
// middleware.config.js | ||
module.exports = { | ||
integrations: { | ||
ct: { | ||
location: '@vue-storefront/commercetools-api/server', | ||
configuration: { | ||
// irrelevant configuration was omitted for readability | ||
serverApi: { | ||
operations: [ | ||
'createProductType' | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters