Skip to content

Commit c145d1f

Browse files
committed
Add example query string from dev docs
1 parent 02d2698 commit c145d1f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

docs/oauth-workflow-example.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Example OAuth workflow
22

3-
The Shopify Python API [validates HMAC and timing attacks](https://shopify.dev/apps/auth/oauth/getting-started#step-2-verify-the-installation-request) with the `request_token` function. Below is a basic example OAuth workflow for a FastAPI app.
3+
The Shopify Python API [validates HMAC and timing attacks](https://shopify.dev/apps/auth/oauth/getting-started#step-2-verify-the-installation-request) with the `request_token` function. Below is a basic example OAuth workflow for a FastAPI app.
44

55

66
## Setup
@@ -19,7 +19,7 @@ API_KEY = "api-key"
1919
API_SECRET = "api-secret"
2020

2121
shopify.Session.setup(api_key=API_KEY, secret=API_SECRET)
22-
```
22+
```
2323

2424
3. Request permissions from the merchant with the `auth_url` from the `create_permission_url` function. Once the merchant acccepts, a temporary token `code` is sent to the specified `redirect_uri` of your app.
2525

@@ -37,22 +37,20 @@ async def install(shop_name: str):
3737
new_session = shopify.Session(shop_url, VERSION)
3838
auth_url = new_session.create_permission_url(scopes, redirect_uri, state)
3939
return RedirectResponse(
40-
url=auth_url,
40+
url=auth_url,
4141
status_code=303
4242
)
4343
```
4444

45-
4. To capture the `code`, set up a callback handler in your app. To exchange the temporary token for a permanent access token, supply the parameters from this request to the `request_token` function.
45+
4. To capture the `code`, set up a callback handler in your app. To exchange the temporary token for a permanent access token, supply the parameters from this request to the `request_token` function. See an [example query string here](https://shopify.dev/apps/auth/oauth/getting-started#step-2-verify-the-installation-request) to be passed as the `request_params`.
4646

4747
```python
4848
@app.get("/auth/shopify/callback")
4949
async def auth_callback(request: Request):
5050
request_params = dict(request.query_params)
5151
shop_url = request_params.get("shop")
52-
52+
5353
session = shopify.Session(shop_url, VERSION)
5454
access_token = session.request_token(request_params)
5555
# store access_token
5656
```
57-
58-

0 commit comments

Comments
 (0)