Help forum

supabase auth with provider

  • Abhishek Sahni (Abhi)

    1 year ago

    Hi,

    I am using Supbase as a db and the Authentication. For the Auth part I would like to use login with linkedin.

    I created a button and added an onclick event to link to https://<my_url>.supabase.co/auth/v1/authorize?provider=linkedin_oidc&redirect_to=https://<my_url>.supabase.co/auth/v1/callback. When I click on the button I am redirected to the linkedin login page and once I sign in an account is created in the users table in my supabase DB.

    Questions:
    1. Once the user successfully logins in with Supabase they are redirected to http://localhost:3000/#access_token=<XXXXXXX>. How do I bring the user back to the toddle app? 
    2. How do I extract the access_token from the call back url?
    3. Is adding this as an API the recommended approach? Based on the tutorials it is easier to extract the access token from the API response

    Thank you
    ✅1
  • Ben H

    1 year ago

    Basically you need to make a toddle page that you redirect to that extracts the access token from the url and saves it as a cookie. Make sure you add your url to the permitted redirects list in Supabase.
    🙏1
  • I could show you a full example later (ie tomorrow)
  • Ben H

    1 year ago

    I prefer to open the login window in a popup so the user isn’t pulled from their original context
  • Abhishek Sahni (Abhi)

    1 year ago

    You sir are amazing, thank you. I was missing the permitted redirects in Supabase.
  • Abhishek Sahni (Abhi)

    1 year ago

    Intersting, I will read up about doing this, thank you again
  • Ben H

    1 year ago

  • Abhishek Sahni (Abhi)

    1 year ago

    this is amazing, thank you
    👍1