Correct way to redirect
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.9k
- Forks
- 739
- Avg merge
- 21h 2m
- Merged PRs (30d)
- 1
Description
Overview/summary
Hi,
We use Turbolinks and have no trouble using UJS redirect. However, if we need to do a html-based redirect, what is the proper way to do this?
In shopify_app 22.2.1, we used to do the following by adding the shop params already in the original request
In controller (after authentication):
respond_to do |format|
format.html {
@redirect_to = edit_orders_path(shop: params[:shop])
}
end
Then in html.erb, we have:
Turbolinks.visit("<%= @redirect_to %>");
However, in shopify_app 22.5.1, that doesn't work we get ShopifyAPI::Errors::InvalidJwtTokenError, with message "Error decoding session token"
Any suggestions?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the controller's respond_to block and the html.erb template using Turbolinks.visit, focusing on the change from shopify_app 22.2.1 to 22.5.1. Reproduce the redirect after authentication and trace the resulting ShopifyAPI::Errors::InvalidJwtTokenError. Done means the supported HTML redirect path no longer produces the session-token decoding error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100