-
Notifications
You must be signed in to change notification settings - Fork 222
FIX: /auth redirects to / endpoint even if custom prefix setup #1498
FIX: /auth redirects to / endpoint even if custom prefix setup #1498
Conversation
@TheMallen @alexandcote @vsumner @ismail-syed Could you please have a look at this one please? Really appreciate that. |
@@ -10,7 +10,7 @@ const requestStorageAccess = (shop: string, prefix = '') => { | |||
doesNotHaveStorageAccessUrl: "${prefix}/auth/enable_cookies?shop=${encodeURIComponent( | |||
shop, | |||
)}", | |||
appTargetUrl: "/?shop=${encodeURIComponent(shop)}" | |||
appTargetUrl: "${prefix}?shop=${encodeURIComponent(shop)}" |
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.
I believe we'll still need the /
at the beginning. Can we update the default prefix
in the function argument to be '/'
instead of ''
?. Users who set a prefix will need to make sure the use a /
(eg. /my-prefix
)
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.
👆
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.
You are right, sorry. I've updated PR, so it will use '/' path in case there is no prefix setup. Thanks a lot for reviewing this!
…th' into bugfix/prefix-for-koa-shopify-auth
@@ -10,7 +10,7 @@ const requestStorageAccess = (shop: string, prefix = '') => { | |||
doesNotHaveStorageAccessUrl: "${prefix}/auth/enable_cookies?shop=${encodeURIComponent( | |||
shop, | |||
)}", | |||
appTargetUrl: "/?shop=${encodeURIComponent(shop)}" | |||
appTargetUrl: "${prefix || '/'}?shop=${encodeURIComponent(shop)}" |
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.
I should have been more clear earlier, sorry. I meant in line 2 we can make the following change
- const requestStorageAccess = (shop: string, prefix = '') => {
+ const requestStorageAccess = (shop: string, prefix = '/') => {
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.
gotcha, less conditions :) I made a change, please have a look
@@ -7,6 +7,8 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | |||
|
|||
<!-- ## [Unreleased] --> | |||
|
|||
- Include `prefix` when redirect to the root endpoint |
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.
Last nit: please add a link to the PR at the end of this like (eg. [[#PR_NUMBER]](LINK)
)
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.
Cheers, done
@ismail-syed Could we merge this one please? |
@dooman87 merged, sorry for the delay! |
Argh, you are right, sorry. I didn't wait until release and used my fork without latest changes to default value :( |
From #1428 (comment):
and #1440 (comment):
Not that it bothers me greatly because I'm maintaining my own copy of koa-shopify-auth now, but you might want to re-consider this "fix". |
I see where you are coming from and I think having two separate prefixes would be a good solution. However, I think using prefix in |
Not sure how this is better than being able to configure api and app prefix separately? Or do you mean it's better than not applying any prefix to It's just that this is a breaking change not just a "fix", because I'm using a prefix for the api only ( Also, if I used a prefix the way you are, I'd still need two separate prefixes, e. g. |
Yup, you would still need two separate routes for I think you are right and we did need to bump major version in this case. Sorry, I thought it's just a bug cause saw a ticket and then PR you mentioned above that's been closed because of big refactor. That was my first app and first experience with |
|
Description
Fixes (issue #) #1148
The issue is marked as fixed however the prefix still doesn't work if
https://APP_HOST/
doesn't return 302 to auth endpoint.Type of change