PricingBlog

Xano, Auth0, Toddle Stack for authentication. How does it work?

  • xioteer-1246499794344480849

    Xioteer

    1 year ago

    Hi everyone!

    I am trying to get the above stack to work, have the first step done, but have no clue how to proceed.
    This is my first time doing actual authentication, so please bear with me.

    Everything is set up on the Xano and auth0 side (I think)

    With the click on a button I am opening the login page of auth0 and can successfully register or log in.
    The problem I have is now that I am getting sent back to the specified redirect_uri and have no clue what to do actually.
    I can see the that URL has now ?code=XYZ attached, but I am not sure how to handle the rest and how to make the rest react or set the access token and most of all, how to make sure that there is a user attached in my xano database.

    I know that there are two API endpoints in Xano. Init and continue. So I assume I will have to work now with the continue?
  • andreasmoller-1246534168691740724

    Andreas Møller

    1 year ago

    Checkout day3 in "first week in toddle" https://docs.nordcraft.com
  • xioteer-1246755772247834745

    Xioteer

    1 year ago

    Hi Andreas, thanks for that. But auth0 is inherently different from the flow, is it not?
  • andreasmoller-1246857459596001380

    Andreas Møller

    1 year ago

    Yes, sorry why do you want to use xano and auth0? Can xano not do what you want?
  • xioteer-1246860586894098442

    Xioteer

    1 year ago

    @Andreas Møller Absolutely! It would be absolutely fine, but then we are looking at triggering lost pw emails, renewals, etc. So I think an integration like auth0 makes sense, as it takes most of that away
  • andreasmoller-1246860797393768450

    Andreas Møller

    1 year ago

    Does xano not take Care of that?
  • andreasmoller-1246861050914279454

    Andreas Møller

    1 year ago

    We dont have a guide on Auth0, but it is definitely possible
  • I am bot sure it is worth it though
  • xioteer-1246863695867412531

    Xioteer

    1 year ago

    It's pretty much just the lack of knowledge from my side how the process itself works.

    I am learning step by step at the moment and am getting closer on having it working (conceptually)

    Currently stuck at trying to figure out how I parse the query parameter "code" from the URL after I am getting redirected back to the toddle site for the 2nd step.

    1. Step is triggering the auth0 login/signup. This sends me then back to the toddle site with the "code" attached to the url
    2. Step is taking the code, sending it then back to auth0(xano api), which then finally sends over the token.
  • andreasmoller-1246864283095273573

    Andreas Møller

    1 year ago

    You need to set a query parameter in the toddle page named code
  • xioteer-1246865071888531558

    Xioteer

    1 year ago

    Oh wow! That's actually brilliant.
    I was working on parsing the current url
  • andreasmoller-1246867813189292113

    Andreas Møller

    1 year ago

    🙂
  • xioteer-1246901632525013002

    Xioteer

    1 year ago

    @Andreas Møller Is there any literature on how to get user specific data from Xano? I am a bit lost with using the authorization token then to determine the current user.
    Auth0 is sending name, email and auth token over. The token is stored as session cookie.

    Not sure if I have to store anything further for the session to be used in api calls as params or whether I can utilize the existing session cookie for that
  • andreasmoller-1246910287743942707

    Andreas Møller

    1 year ago

    It depends on your setup but usually you have a auth/me endpoint
  • xioteer-1246910811008405514

    Xioteer

    1 year ago

    And that is exactly what I don't have with Auth0.

    Will investigate and see what it brings
  • andreasmoller-1246919459231502357

    Andreas Møller

    1 year ago

    You could still make it in xano
  • xioteer-1246923908280487936

    Xioteer

    1 year ago

    Yeah, I am pretty much fed up by now of the whole ordeal and will probably revert to the standard Xano method, where you have the tutorials for.
    As I said, it's probably a lack of knowledge on my part regarding the inner workings of Oauth in general, so making small steps and focussing on the core features of the app will be better for now.
  • andreasmoller-1246925284058595479

    Andreas Møller

    1 year ago

    I used Auth0 for one of the early early alpha versions of toddle back in 2019. It honestly took me longer that it would have taken to implement my own auth system 😦
  • andreasmoller-1246925804634374164

    Andreas Møller

    1 year ago

    We use Make + MailerSend for most of our emails It is pretty simple to setup and can probably handle most of the problems you are looking to solve.
  • xioteer-1246926315685417123

    Xioteer

    1 year ago

    Makes absolute sense.

    Quick question:
    Why put Make in between? Just curiosity
  • andreasmoller-1247037419262443581

    Andreas Møller

    1 year ago

    I our case we are running supabase on the backend, so we don’t have an other way of running backend workflows (without code)
  • xioteer-1247102871917432854

    Xioteer

    1 year ago

    Got it! Thanks for the info 🙂