-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shopify-app-remix
scopes API documentation
#1506
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Jonathan J Chang <jonathan.j.chang@shopify.com>
Co-authored-by: Allen Chazhoor <allen.chazhoor@shopify.com>
…uery Co-authored-by: Allen Chazhoor <allen.chazhoor@shopify.com>
@@ -32,6 +32,7 @@ const data: ReferenceEntityTemplateSchema = { | |||
'EmbeddedAdminContext', | |||
'AdminApiContext', | |||
'BillingContext', | |||
'ScopesApiContext', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The page with these examples is so weird. There are no headers between the sets of examples, so it looks like everything is related, even though there are billing things mixed in with scopes. Maybe not something for us to fix, but it feels like something to flag to Learn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, this page is problematic.
+1, not necessarily something we need to fix here, but would be great to rethink this page & its purpose
const data: ReferenceEntityTemplateSchema = { | ||
name: 'Scopes', | ||
description: | ||
'Contains functions used to manage optional scopes for your app.\n\nThis object is returned on authenticated Admin requests.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Contains functions used to manage optional scopes for your app.\n\nThis object is returned on authenticated Admin requests.', | |
'Contains functions used to manage scopes for your app.\n\nThis object is returned on authenticated Admin requests.', |
I remember Jake making a point to say that this was the "scopes api", not the "optional scopes api". What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate question: how are scopes managed for the storefront API? We don't want optional scopes for the storefront API, right?
.../apps/shopify-app-remix/src/server/authenticate/admin/scope/authenticate.admin.scopes.doc.ts
Outdated
Show resolved
Hide resolved
packages/apps/shopify-app-remix/src/server/authenticate/admin/types.ts
Outdated
Show resolved
Hide resolved
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Outdated
Show resolved
Hide resolved
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Outdated
Show resolved
Hide resolved
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Outdated
Show resolved
Hide resolved
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Outdated
Show resolved
Hide resolved
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Show resolved
Hide resolved
…embedded app auth strat section
28d879f
to
af3f849
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love seeing this and all the work you've put into it, Ryan! Thank you for working on this 🙌
I'm in process of reviewing this and I have a dumb question... but where does the code for the examples on the right live?
For example, for the query
method, I was going to propose a few changes
- rather than set up a Resource Route we POST to for retrieving data through
action
, we could show using a Resource Route for retrieving data throughloader
. TheuseRouteLoaderData
hook can be used for scenarios like this to then pull in data from other routes request
method example was a bit convoluted (may be clearer to just have anaction
and button on the same page, instead of using a Resource Route) and not clear that it leads to a full page redirect.
I was about to write "similar to the above" for the revoke
method but now I'm wondering if it would just be overall better to demonstrate these being used in loader
s and action
s right on the same page. It’s a bit less mental overhead for looking at the examples, and would change the examples from having 3 tabs/files to 2 tabs/files — importantly, with all the relevant details in the first/visible tab.
What do you think about that suggestion?
@@ -32,6 +32,7 @@ const data: ReferenceEntityTemplateSchema = { | |||
'EmbeddedAdminContext', | |||
'AdminApiContext', | |||
'BillingContext', | |||
'ScopesApiContext', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, this page is problematic.
+1, not necessarily something we need to fix here, but would be great to rethink this page & its purpose
.../apps/shopify-app-remix/src/server/authenticate/admin/scope/authenticate.admin.scopes.doc.ts
Show resolved
Hide resolved
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Outdated
Show resolved
Hide resolved
Put up the recent changes here: https://shopify-dev.shopify-dev-3h44.allen-chazhoor.us.spin.dev/docs/api/shopify-app-remix/v3/apis/scopes |
No worries, it's different from ABN docs in that the code examples are directly in the docstring here. I think the current docs on the Spin instance are also outdated as we decided to remove the button examples per Pierre's feedback and to be more consistent with the rest of the documentation that simply show an action or loader.
I'm on board with using a Resource Route like Billing here. We chose to use an action as it is consistent with our getting started app, but we should use the correct primitives that Remix provides.
I address this in the first part of my response above - we did choose to remove the button completely and reduce to 2 tabs with a focus on just the action. Apologies for not updating the instance. What do you think about that suggestion? |
I've replaced the usage of actions to use loaders. Because we removed the button files, I believe the examples in their current state are accurate but please let me know if more additions/adjustments need to be made. cc @RyanDJLee @kbav |
There is also this comment from the App Bridge PR that I believe is relevant here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I steered you wrong re: converting all to use loader
; if I did, I meant to just request that for the query
example. I think the other two could leverage a resource route pattern, much like Ryan & co. leveraged for making the optional scopes test app
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Outdated
Show resolved
Hide resolved
* | ||
*import { authenticate } from "../shopify.server"; | ||
*import { AuthScopes } from "@shopify/shopify-api"; | ||
*export async function loader({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the context below, it looks like this is being set up more specifically as an action
: request.formData()
, etc.
I think the query
makes sense in a loader
, but request
perhaps best makes sense as part of a resource route's action
, and perhaps the same for revoke
. Worth testing for those
/** | ||
* Revokes the provided scopes from this app on this shop | ||
* | ||
* **Warning:** This method throws an [error](https://shopify.dev/docs/api/admin-graphql/unstable/objects/AppRevokeAccessScopesAppRevokeScopeError) if the provided optional scopes contains a required scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If other API’s don't use this pattern of adding a bolded "Warning", I'd consider dropping the word entirely
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Outdated
Show resolved
Hide resolved
packages/apps/shopify-app-remix/src/server/authenticate/admin/scope/types.ts
Outdated
Show resolved
Hide resolved
shopify-app-remix
scopes API documentationshopify-app-remix
scopes API documentation
#gsd:39564
WHY are these changes introduced?
Spin url: https://shopify-dev.shopify-dev-3h44.allen-chazhoor.us.spin.dev/docs/api/shopify-app-remix/v3/apis/scopes
(resume on Spin Control if necessary)
WHAT is this pull request doing?
Type of change
Documentation
Checklist
pnpm changeset
to create a draft changelog entry (do NOT update theCHANGELOG.md
files manually)