You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Access scope changes are handled by [Shopify managed installation](https://shopify.dev/docs/apps/auth/installation#shopify-managed-installation)
38
43
39
44
## Note about Rails
40
45
If using in the Rails framework, we highly recommend you use the [shopify_app](https://github.com/Shopify/shopify_app) gem to perform OAuth, you won't have to follow the instructions below to start your own OAuth flow.
@@ -94,7 +99,7 @@ end
94
99
95
100
```
96
101
97
-
### Authorization Code Grant Flow
102
+
### Authorization Code Grant
98
103
##### Steps
99
104
1.[Add a route to start OAuth](#1-add-a-route-to-start-oauth)
100
105
2.[Add an Oauth callback route](#2-add-an-oauth-callback-route)
@@ -265,9 +270,41 @@ def callback
265
270
end
266
271
end
267
272
```
268
-
269
273
⚠️ You can see a concrete example in the `ShopifyApp` gem's [CallbackController](https://github.com/Shopify/shopify_app/blob/main/app/controllers/shopify_app/callback_controller.rb).
270
274
275
+
### Client Credentials Grant
276
+
277
+
> [!NOTE]
278
+
> You can only use the client credentials grant when building apps for your own organization.
279
+
280
+
> [!WARNING]
281
+
> [token exchange](#token-exchange) (for embedded apps) or the [authorization code grant](#authorization-code-grant) should be used instead of the client credentials grant, if your app is a browser based web app.
282
+
283
+
#### Perform Client Credentials Grant
284
+
Use [`ShopifyAPI::Auth::ClientCredentials`](https://github.com/Shopify/shopify-api-ruby/blob/main/lib/shopify_api/auth/client_credentials.rb) to
285
+
exchange the [app's client ID and client secret](https://shopify.dev/docs/apps/build/authentication-authorization/client-secrets) for an access token.
286
+
#### Input
287
+
| Parameter | Type | Required? | Default Value | Notes |
|`shop`|`String`| Yes | - | A Shopify domain name in the form `{exampleshop}.myshopify.com`. |
290
+
291
+
#### Output
292
+
This method returns the new `ShopifyAPI::Auth::Session` object from the client credentials grant, your app should store this `Session` object to be used later [when making authenticated API calls](#using-oauth-session-to-make-authenticated-api-calls).
293
+
294
+
#### Example
295
+
```ruby
296
+
297
+
# `shop` is the shop domain name - "this-is-my-example-shop.myshopify.com"
0 commit comments