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

Shopware App Bundle Authentication Failure due to Trailing Slash #54

Closed
DannyDan opened this issue Jan 11, 2025 · 2 comments
Closed

Shopware App Bundle Authentication Failure due to Trailing Slash #54

DannyDan opened this issue Jan 11, 2025 · 2 comments

Comments

@DannyDan
Copy link

Summary
Authentication fails in the Shopware app-bundle when the shop_url property contains a trailing slash, causing token retrieval to fail due to malformed URL construction.

Description
When using the Shopware app-bundle in a Symfony server backend application, if the shop_url property ends with a forward slash (/), the authentication process fails. This occurs because the URL for obtaining the OAuth token becomes malformed, resulting in a double slash in the path.
Current Behavior

When shop_url ends with a slash (e.g., "www.test.de/")
The resulting OAuth token URL becomes: "www.test.de//api/oauth/token"
Authentication fails due to the malformed URL with double slashes

Expected Behavior
OAuth token URL should always be correctly formed with a single slash
Authentication should succeed regardless of whether shop_url has a trailing slash
Expected URL format: "www.test.de/api/oauth/token"

Steps to Reproduce
Configure Shopware app-bundle in a Symfony server backend application
Set shop_url property with a trailing slash (e.g., "www.test.de/")
Attempt to authenticate
Observe authentication failure

Impact
Critical severity as it prevents successful authentication
Affects all implementations where shop_url might contain a trailing slash
May cause production issues if not caught during development

Suggested Fix
Implement URL normalization for the shop_url property:

Either strip trailing slashes from shop_url before use
Or implement proper URL path joining that handles slashes correctly

Environment
Component: Shopware app-bundle
Framework: Symfony
Context: Server backend application

Additional Notes
This issue requires immediate attention as it affects core authentication functionality. Consider adding validation or automatic normalization of the shop_url property to prevent this issue.

@nsaliu
Copy link
Contributor

nsaliu commented Jan 15, 2025

This issue was solved in this project shopware/app-php-sdk by shopware/app-php-sdk#26 and this one shopware/app-php-sdk#32 (will be merged soon) will fix the proof generation.

@shyim
Copy link
Member

shyim commented Jan 17, 2025

fixed

@shyim shyim closed this as completed Jan 17, 2025
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

No branches or pull requests

3 participants