Login/auth/me not working in toddle when adding "NOW" as a date in the Body

  • renske.renske-1342466065015509103

    R

    22 days ago

    I am trying to amend the login so it records the last date a user was logged in. The login works and has worked for a while now - following the tutorial on Xano*Toddle from YT.

    I updated the auth/login in Xano so it accepts a date, and it works perfectly in Xano. In addition to returning the auth token, it patches the user record with the current date.

    However in toddle, the reponse is odd: when I click on the '' sign in the API editor when including NOW in the body as 'login_time', nothing happens. The API call is logged in Xano as successful and is showing an auth token in Xano. But in toddle it does not show up. It changes from Loading: false to Loading: true and back for 1 second. Within this time, the auth token shows up in the editor in toddle but vanishes again (more like flickering than actually showing up). This new login also does not work in preview.

    To debug, I copied the login API call in toddle and removed the login time again from the body. This still works and returns the auth token. Am I overlooking something with the 'Now' formula that affects this?

    Can't post many pictures as it is all auth related, but thus is the part of the formula I use for the datetime.
    1342466065367826493-image.png
  • erikbeus-1342474335322902549

    Erik Beuschau

    22 days ago

    Try adding the Format Date formula after the Now formula. The Now formula outputs a Date object - not a string.
  • renske.renske-1342546872539152467

    R

    22 days ago

    Thank you Erik!
    Changed it to unix & added the string formula just in case, still the same behavior.

    If I change the value to '1' it works. Also, if I change the 'now' value to a normal date the API call works. With now it does not work.
    1342546872438620222-image.png
    1342546872081977437-image.png
  • erikbeus-1343493812529532958

    Erik Beuschau

    19 days ago

    What date/time format does Xano expect/support?
  • renske.renske-1346136321726611489

    R

    12 days ago

    The same error persists whether I used a timestamp (which expects unix epoch) as well as just plain text.

    What solved this error was to add a variable in Toddle that stores 'Now' and then refer to the variable in the body of the Xano Login API call, rather than to include 'Now' directly in the body object.

    The login api without the variable worked very sporadically when clicking manically, so I suspect that because 'now' changes every milisecond, the API call does not work as expected.

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code — but accessible to your entire team!

Try toddle — it's free!

© Copyright 2024 toddle. All rights reserved.