Login With Any Platform in React With Supabase (Discord, Google, Facebook, and More!)

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ต.ค. 2024

ความคิดเห็น • 55

  • @UseOf
    @UseOf ปีที่แล้ว +22

    For anyone else who has an issue with sign out causing the app to freeze, you need to change the code he wrote at 10:50 to:
    supabase.auth.onAuthStateChange(async (event) => {
    if (event == "SIGNED_IN") {
    navigate("/success");
    }
    });
    Something must have changed on Supabase side which causes this event listener to trigger an infinite navigate loop.

  • @CooperCodes
    @CooperCodes  ปีที่แล้ว +3

    Hey It's Cooper Codes, Supabase changed their UI since the recording of this video but everything you need to find regarding Supabase setup should be in the menu here: imgur.com/a/6lIzDPh the redirect URL and other things got tucked away into different sections so hopefully there isn't too much confusion here. Comment here if you are missing anything! Thanks.

  • @iGamerD2
    @iGamerD2 ปีที่แล้ว

    My man just carried dashboard handling for my bot, tysm

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว

      You are welcome, glad it helped :)

  • @Hyp3rFX
    @Hyp3rFX 2 ปีที่แล้ว

    Great video! Thanks so much. ❤
    Your seriously underrated.

    • @CooperCodes
      @CooperCodes  2 ปีที่แล้ว

      Thank you so much, for some reason I missed this comment. Appreciate the support :)

  • @zerqPROSPIELER
    @zerqPROSPIELER ปีที่แล้ว

    The best tutorial so far bro! Keep it up, sub

  • @jakubn.6572
    @jakubn.6572 2 หลายเดือนก่อน

    Thank you very much! Really appreciate this guide.

  • @AndrewDBrown2020
    @AndrewDBrown2020 ปีที่แล้ว +1

    That's such a great help - thank you.

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว

      You're welcome Andy, appreciate the comment

  • @Ross17
    @Ross17 ปีที่แล้ว +1

    it has been very helpful, thank you.

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว

      you're welcome! thanks for watching

  • @MarkiMark01
    @MarkiMark01 2 หลายเดือนก่อน

    Thank you very much!

  • @LeighBriody
    @LeighBriody ปีที่แล้ว

    Great video ! How do we manage the user who is currently logged in ? Can we store them in a session and use their email as an id for our database ?

  • @robbiewinfield7853
    @robbiewinfield7853 9 หลายเดือนก่อน

    Is there any way to not have the login page redirect the user to the success page if they are already logged in? If someone is just interested in switching their account, then this may be useful. I guess what I'm looking for is how to only make it redirect when that user actually just clicked "log in" and not whenever an already logged-in user goes to the login page.

  • @Bubuljusak
    @Bubuljusak ปีที่แล้ว

    Hello! I have found that supabase o auth with azure in expo React Native is not working… can you give it a go ? And post a video?

  • @techuser1619
    @techuser1619 2 ปีที่แล้ว +4

    Do you think it’s possible to only allow “Sign in with Discord” only if the user is part of a Discord server? Would be cool to give Discord server members access to custom dashboards with their stats.

    • @CooperCodes
      @CooperCodes  2 ปีที่แล้ว +1

      I can definitely integrate something like this into a project.
      My first assumption is that you create some auth middleware (some in-between steps with your authorization). When you authorize a user on your webpage, you can check the supabase user object to see 1. They logged in with discord 2. Make a call to the discord API with their credentials, seeing if they are part of a certain server.
      I will note, for a sign in like this you can actually make it so supabase ONLY allows Discord sign ins (pretty legit!). Hopefully this gets you in the right direction. You can do this by going into authorizations in supabase and disabling the email sign in (and for the Auth component shown in this video there is a property I believe to show only the social logins aka Discord on the front end).

    • @JamesPero
      @JamesPero ปีที่แล้ว

      The property is called "onlyThirdPartyProviders" and it's a boolean value.

  • @hitesh2293
    @hitesh2293 5 หลายเดือนก่อน

    How are you navigating to success page after login? ??

  • @RedRhinoPlayz
    @RedRhinoPlayz 10 หลายเดือนก่อน

    Good Stuff Man

  • @M4CARBINE556
    @M4CARBINE556 ปีที่แล้ว

    What about navigating to other pages? Will the user still be signed in? Do you have to do the Supabase client on every page?

    • @Peppzwerg
      @Peppzwerg ปีที่แล้ว

      You can pass the userobject down the childs or try using something like redux

    • @anthonyngooo
      @anthonyngooo ปีที่แล้ว

      You can also use something like private routes

  • @bobo21D
    @bobo21D ปีที่แล้ว

    Fantastic vid

  • @lolelylove8049
    @lolelylove8049 ปีที่แล้ว

    Hm how setup it using google and facebook?

  • @nested9301
    @nested9301 ปีที่แล้ว

    is this the free tier ? also what is the diffrence between this and sso

    • @anthonyngooo
      @anthonyngooo ปีที่แล้ว

      Yes this is the free tier. Not sure about the second part of your question

  • @Deus-lo-Vuilt
    @Deus-lo-Vuilt ปีที่แล้ว

    thanks for video

  • @itsgox
    @itsgox ปีที่แล้ว

    so i cant get the user guilds with this?

    • @GUCKII
      @GUCKII ปีที่แล้ว

      why you can't? I haven't tried, but I think you just have to select guilds in URL generator and then you will be able to get data about user guilds.

  • @soko_sskk
    @soko_sskk 2 ปีที่แล้ว

    U are the best

    • @soko_sskk
      @soko_sskk 2 ปีที่แล้ว

      More supabase tutorials plsss

    • @CooperCodes
      @CooperCodes  2 ปีที่แล้ว

      I got you with more supabase stuff, thanks for watching!

  • @rgx11zprotv23
    @rgx11zprotv23 ปีที่แล้ว

    hey does it work for a mobile version of the app ?

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว +1

      I believe it should, I'd be surprised if it didn't.

    • @rgx11zprotv23
      @rgx11zprotv23 ปีที่แล้ว

      @@CooperCodes thx i'll probably try

  • @berendvanbeerschot1472
    @berendvanbeerschot1472 ปีที่แล้ว

    This is not the safe way to do it. Seems really vulnerable to me!

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว

      Could you provide an explanation? This solution is generally standard for authentication, and is secure as long as you trust the calls to Supabase to be secure (which I do). Supabase has excellent token management (managing both refresh and access tokens) which is reliable even from an advanced security perspective.

    • @berendvanbeerschot1472
      @berendvanbeerschot1472 ปีที่แล้ว

      @@CooperCodes You put the url and anon key in the login page instead of in an env for starters.

    • @CooperCodes
      @CooperCodes  ปีที่แล้ว +2

      That is because this is a tutorial (and I don't cover everything), you can easily swap those strings out. If you need to learn how you can check out this video here: th-cam.com/video/0i1hGQKw2eE/w-d-xo.html . I generally note this in videos when using the API keys in string format but I forgot to mention it here.

  • @kalidsherefuddin
    @kalidsherefuddin 2 ปีที่แล้ว

    How to activate it

    • @CooperCodes
      @CooperCodes  2 ปีที่แล้ว +1

      Do you mean how to activate a certain OAuth provider (like Facebook or Google for example)? In Supabase you want to go to Authentication (the icon with two people) and then go to settings inside of Authentication (under Configuration), once you scroll down you will see all the possible OAuth providers as shown in the video. At each provider if you click on it there will be a little slider icon to enable / disable that particular login, but you need to have the credentials for the certain provider.
      For example, to enable Facebook you need the Facebook Client ID and Client Secret which you will get from going over to Facebook and setting up OAuth with them. Once you have the ID and secret you can then enable Facebook for login.