Skip to content

Commit 0d384c2

Browse files
committed
Add docs
1 parent 073885b commit 0d384c2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/usage/oauth.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ class ShopifyCallbackController < ApplicationController
123123
```
124124

125125
#### 3. Begin OAuth
126+
To request access scopes from the shop during authorization code grant OAuth flow,
127+
configure access scopes needed by adding the `scope` parameter to the `ShopifyAPI::Context.setup` method in your configuration.
128+
129+
```ruby
130+
ShopifyAPI::Context.setup(
131+
api_key: <SHOPIFY_API_KEY>,
132+
api_secret_key: <SHOPIFY_API_SECRET>,
133+
api_version: <SHOPIFY_API_VERSION>,
134+
scope: <SHOPIFY_API_SCOPES>, # Accepts array or string: "read_orders, write_products" or ["read_orders", "write_products"]
135+
...
136+
)
137+
```
138+
126139
Use [`ShopifyAPI::Auth::Oauth.begin_auth`](https://github.com/Shopify/shopify-api-ruby/blob/main/lib/shopify_api/auth/oauth.rb#L22) method to start OAuth process for your app.
127140

128141
#### Input
@@ -131,6 +144,7 @@ Use [`ShopifyAPI::Auth::Oauth.begin_auth`](https://github.com/Shopify/shopify-ap
131144
| `shop` | `String` | Yes | - | A Shopify domain name in the form `{exampleshop}.myshopify.com`. |
132145
| `redirect_path` | `String` | Yes | - | The redirect path used for callback with a leading `/`. The route should be allowed under the app settings. |
133146
| `is_online` | `Boolean` | No | `true` | `true` if the session is online and `false` otherwise. |
147+
| `scope_override`| `String` or `[String]` | No | `nil` | `nil` will request access scopes configured in `ShopifyAPI::Context.setup` during OAuth flow. Modify this to override the access scopes being requested. Accepts array or string: "read_orders, write_products" or ["read_orders", "write_products"]. |
134148

135149
#### Output
136150
`begin_auth` method will return a hash result in the form of:

0 commit comments

Comments
 (0)