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

Correct way to redirect #1934

Open
netwire88 opened this issue Jan 7, 2025 · 3 comments
Open

Correct way to redirect #1934

netwire88 opened this issue Jan 7, 2025 · 3 comments

Comments

@netwire88
Copy link

netwire88 commented Jan 7, 2025

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?

@netwire88
Copy link
Author

netwire88 commented Jan 8, 2025

We also tried

  1. ensuring AuthenticatedController has include ShopifyApp::WithShopifyIdToken
  2. and in controller, call redirect_to edit_orders_path(shop: jwt_shopify_domain)

but we get INTERNAL ERROR!!! TypeError: Parameter 'other': Expected type T.nilable(ShopifyAPI::Auth::JwtPayload), got type Module with value Debase

@netwire88 netwire88 changed the title Proper way to redirect Correct way to redirect Jan 8, 2025
@remy727
Copy link
Contributor

remy727 commented Jan 13, 2025

Can you try using fullpage_redirect_to(url)?

@netwire88
Copy link
Author

Thanks, that seemed to have worked. However, after the page loads, it still gets "ShopifyAPI::Errors::InvalidJwtTokenError: Error decoding session token: Signature has expired" sometimes. Is there a way to add all these helper methods to documentation? I didn't find it anywhere.

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

2 participants