Skip to content
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

[Bug] Fixes session.create_permission_url() to omit scope param if not required #757

Merged
merged 8 commits into from
Jan 20, 2025

Conversation

tylerj117
Copy link
Contributor

WHY are these changes introduced?

To align with Shopify API Docs for 3xx redirects.

Fixes #756

3xx redirects for non-embedded apps using Shopify Managed Installation do not require scopes in the query parameter if provided by the app's TOML, per Shopify Docs.

WHAT is this pull request doing?

Adding scopes to auth_url query param only if provided in functional, otherwise, omitting it.

Checklist

  • I have updated the CHANGELOG (if applicable)
  • I have followed the Shopify Python guide

Modified `create_permission_url` to make `scope` optional, allowing it to be omitted when specified in the app's configuration (TOML). Updated the README to reflect this change and clarify usage. This improves flexibility and simplifies configuration management.
Removed an unnecessary extra space in the method signature of `create_permission_url`.
@tylerj117
Copy link
Contributor Author

I have signed the CLA.

@Arkham
Copy link
Contributor

Arkham commented Jan 17, 2025

hi @tylerj117, thanks for your contribution! Could you please update the tests in test/session_test.py?

Updated tests to improve clarity and consistency in naming and arguments. Modified `create_permission_url` calls to match new positional order for `redirect_uri` and `scope`. Enhanced assertion coverage for edge cases like empty scopes and added tests for state parameter handling.
@tylerj117
Copy link
Contributor Author

Apologies @Arkham; test/session_test.py has been updated.

  • tests added for invoking function omitting scope param with and without state
  • fixed parameters for all other create_permission_url tests, including renaming tests to match new param order

@Arkham
Copy link
Contributor

Arkham commented Jan 20, 2025

@tylerj117 thanks! it seems there are just a couple of linting errors and then we can merge this.

Removes extra white space in parameters in session_test.py and changes conditional formatting in shopify/session.py.
Removes extra white space in parameters in session_test.py and changes conditional formatting in shopify/session.py.
@tylerj117
Copy link
Contributor Author

@Arkham Linting errors fixed, thanks!

@Arkham Arkham merged commit f58c991 into Shopify:main Jan 20, 2025
7 checks passed
@Arkham
Copy link
Contributor

Arkham commented Jan 20, 2025

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scope param required in create_permission_url func but should be omitted for managed installations
2 participants