This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/npm_and_yarn/swc/core-1.3.107
- Loading branch information
Showing
24 changed files
with
906 additions
and
146 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@shopify/shopify-api": minor | ||
--- | ||
|
||
Added support for validating Flow extension requests, using `shopify.authenticate.flow`. | ||
|
||
Please see [the `flow` object documentation](./docs/reference/flow/README.md) for more information. |
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,2 @@ | ||
--- | ||
--- |
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,9 @@ | ||
# shopify.flow | ||
|
||
This object contains functions used to authenticate Flow extension requests coming from Shopify. | ||
|
||
| Property | Description | | ||
| ------------------------- | ------------------------------------------------------------------- | | ||
| [validate](./validate.md) | Verify whether a request is a valid Shopify Flow extension request. | | ||
|
||
[Back to shopifyApi](../shopifyApi.md) |
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,66 @@ | ||
# shopify.flow.validate | ||
|
||
Takes in a raw request and the raw body for that request, and validates that it's a legitimate Shopify Flow extension request. | ||
|
||
Refer to [the Flow documentation](https://shopify.dev/docs/apps/flow/actions/endpoints#custom-validation) for more information on how this validation works. | ||
|
||
## Example | ||
|
||
```ts | ||
app.post('/flow', express.text({type: '*/*'}), async (req, res) => { | ||
const result = await shopify.flow.validate({ | ||
rawBody: req.body, // is a string | ||
rawRequest: req, | ||
rawResponse: res, | ||
}); | ||
|
||
if (!result.valid) { | ||
console.log(`Received invalid Flow extension request: ${result.reason}`); | ||
res.send(400); | ||
} | ||
|
||
res.send(200); | ||
}); | ||
``` | ||
|
||
## Parameters | ||
|
||
Receives an object containing: | ||
|
||
### rawBody | ||
|
||
`string` | :exclamation: required | ||
|
||
The raw body of the request received by the app. | ||
|
||
### rawRequest | ||
|
||
`AdapterRequest` | :exclamation: required | ||
|
||
The HTTP Request object used by your runtime. | ||
|
||
### rawResponse | ||
|
||
`AdapterResponse` | :exclamation: required for Node.js | ||
|
||
The HTTP Response object used by your runtime. Required for Node.js. | ||
|
||
## Return | ||
|
||
Returns an object containing: | ||
|
||
### valid | ||
|
||
`boolean` | ||
|
||
Whether the request is a valid Flow extension request from Shopify. | ||
|
||
### If valid is `false`: | ||
|
||
#### reason | ||
|
||
`FlowValidationErrorReason` | ||
|
||
The reason why the check was considered invalid. | ||
|
||
[Back to shopify.flow](./README.md) |
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
Oops, something went wrong.