Help forum

Redirects on mobile

  • Samuel T

    2 years ago

    Hi guys, everything works fine on a pc, login, logout redirects
    But on the phone, when I login it just redirects back to login
    I've tried clearing cache and also incognito but nothing worked
  • Samuel T

    2 years ago

    Maybe it has something to do with the toddle extension?
  • Fisher

    2 years ago

    Out of curiosity, is your phone's browser getting the site in "Desktop Mode" ?
  • Janis

    2 years ago

    Did you set “prevent default” on your login form submission event?
  • Max

    2 years ago

    Can you share the project URL? Then I or someone else can have a look
  • Samuel T

    2 years ago

    Thank you!
  • Samuel T

    2 years ago

    https://peia_affiliates.toddle.site/
    Does this work?
    To explain, I have a workflow on the main page /dashboard that calls a "login" api on load, and if it fails, redirects to /login
    It works good on desktop, but on mobile always redirects back to login
  • @Fisher I don't know 😅
  • @Janis I will try that
    👍1
  • Samuel T

    2 years ago

    @Janis I tried that but the issue persists
  • @Samuel T
    Thank you!

    Fisher

    2 years ago

    Most phone browsers have a "desktop mode" setting, where the browser then behaves like a desktop and not a phone. Trying it in that mode might help narrow down the issue.
  • Janis

    2 years ago

    Can you send a screenshot of your login flow and the actions?
  • Max

    2 years ago

    Hey @Samuel T! The go to url action has to go in the success branch of the set cookie action
    1283024215863459840-image.png
  • Samuel T

    2 years ago

    @Max It looks like this
    1283044056565547028-Screenshot_2024-09-10_at_14.37.38.png
    1283044056926261380-Screenshot_2024-09-10_at_14.37.27.png
  • Samuel T

    2 years ago

    @Janis I don't think mine does, plus I've tested other phones and browsers
    But that should not even cause an issue right? Whether desktop or mobile
  • Max

    2 years ago

    The screenshot I shared is from your project @Samuel T
    This is on the login page. You should call the "go to URL" action in the success branch of the set cookie action. Otherwise it can happen that the cookie is not set
  • Samuel T

    2 years ago

    Makes so much sense. And it worked, thank you @Max !
  • Max

    2 years ago

    Sure 💪
  • Samuel T

    2 years ago

    But do you have any idea why I wasnt having the same issue on desktop?
  • Max

    2 years ago

    I assume that the desktop was just faster and was able to set the cookie before the next action hit.
  • Samuel T

    2 years ago

    Got it 🙂
  • Samuel T

    2 years ago

    @Max One last question about this - in order to redirect anyone who's not logged in from the dashboard to login, I created a workflow but I don't know if that's the right setup. Can you kindly have a look?
  • Samuel T

    2 years ago

    Was asking cos when you click the links in the nav bar to change pages a few times, it redirects you to the login page at some point as if you are not authenticated
  • Max

    2 years ago

    Did you change your project to private? I cannot check the code anymore. My best guess is that you are running on Xano free trial and that you hit your API limits. Could be the reason why the call throws an error
  • Lucas G

    2 years ago

    Or the expiry on the token is set too short
  • Max

    2 years ago

    True, did not think of that 😅
  • Samuel T

    2 years ago

    The expiry is set to 3600
  • Lucas G

    2 years ago

    Yeah that’s low
  • Samuel T

    2 years ago

    @Lucas G What's a recommended number?
  • Lucas G

    2 years ago

    That's up to you. I think 3600 is recommended for security usually but you have to run the refresh token that often
  • I'm fine for my uses to leave it for a week instead of an hour lol
  • Lucas G

    2 years ago

    Which would be 604800
  • It can also depend on what the max is for your backend
  • Samuel T

    2 years ago

    Makes sense - thanks @Lucas G