https://supabase.com/ logo
Join Discord
Powered by
# help
  • j

    jason-lynx

    10/14/2021, 7:05 AM
    you can take a look at the docs here: https://supabase.io/docs/guides/auth/auth-google
  • u

    user

    10/14/2021, 7:06 AM
    but that shows how to login with js. how do i send the data to flask ?
  • j

    jason-lynx

    10/14/2021, 7:07 AM
    https://supabase.io/docs/guides/client-libraries the python options here might help
  • u

    user

    10/14/2021, 7:08 AM
    not yet implemented for python 🙁
  • j

    jason-lynx

    10/14/2021, 7:10 AM
    looks like
    signIn
    should also work?
  • u

    user

    10/14/2021, 7:10 AM
    no
  • u

    user

    10/14/2021, 7:10 AM
    its using email and password
  • u

    user

    10/14/2021, 7:10 AM
    not google
  • j

    jason-lynx

    10/14/2021, 7:10 AM
    ah ok
  • h

    HarryET

    10/14/2021, 8:43 AM
    Under it it says "Third party logins are also handled through signIn()"
  • u

    user

    10/14/2021, 8:44 AM
    look again sir
  • u

    user

    10/14/2021, 8:44 AM
    its not implemented for python
  • h

    HarryET

    10/14/2021, 8:45 AM
    Where does it say that?
  • u

    user

    10/14/2021, 8:45 AM
    click on the python tab
  • h

    HarryET

    10/14/2021, 8:45 AM
    I'm not on the docs lol
  • u

    user

    10/14/2021, 8:45 AM
    ok
  • f

    FelixTran

    10/14/2021, 9:12 AM
    Hi, i'm new. I got stuck on querying and filter data having many to many relations. I have tables
    products
    ,
    categories
    and a table
    product_category
    . How i can query
    products
    that contain any given
    category_id
    . I have my foreign keys set up correctly. This is my code. (it doesn't work)
    Copy code
    js
    let category_id = 2
    await supabase.from('products')
        .select(`
            *,
            brand: brands(
                *
            ),
            categories(
                *
            )
        `)
    .filter('categories.id','cs', category_id)
  • f

    FelixTran

    10/14/2021, 10:34 AM
    never mind, i found the solution
    Copy code
    js
    .filter('product_category.category_id', 'eq', category_id)
  • d

    Dinnerb0ne

    10/14/2021, 11:10 AM
    I tried providing, additional data, like mentioned under options.data but it's not being passed as part of the payload header.
  • d

    Dinnerb0ne

    10/14/2021, 11:10 AM
    https://supabase.io/docs/reference/javascript/auth-signup
  • d

    Dinnerb0ne

    10/14/2021, 11:37 AM
    Even the redirectTo does nothing
  • s

    silentworks

    10/14/2021, 12:11 PM
    You don't need to include
    options
    key, just pass it a javascript object, please paste code instead of a screenshot as it will be easier to assist that way.
  • j

    Johann

    10/14/2021, 12:41 PM
    Hey, sorry for that question, but can you add custom data if someone signsUp via Google?
  • s

    sudo killall windows

    10/14/2021, 12:49 PM
    Whole point of Supabase is to not need a server for that auth?
  • s

    silentworks

    10/14/2021, 1:02 PM
    This is not completely true. It can be used on both client and server for auth.
  • d

    Deleted User

    10/14/2021, 5:53 PM
    I created this issue to implement those features, I will be working on that https://github.com/supabase-community/gotrue-py/issues/22
  • h

    HarryET

    10/14/2021, 7:56 PM
    Hey @User if you look at https://github.com/HarryET/github-chat you can see we just check if the session exists in useeffect
  • h

    HarryET

    10/14/2021, 7:57 PM
    but I also recently found some hooks for react that seam to be working well. I can share the code for that in a sec
  • h

    HarryET

    10/14/2021, 7:57 PM
    Auth Provider:
    Copy code
    ts
    import type { Session, User } from '@supabase/gotrue-js';
    import { createContext, useEffect, useState } from 'react'
    import { useAuthStateChange, useClient } from 'react-supabase'
    
    const initialState: {session?: Session, user?: User} = { session: null, user: null }
    export const AuthContext = createContext(initialState)
    
    type AuthProviderProps = {};
    
    export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
      const client = useClient()
      const [state, setState] = useState(initialState)
    
      useEffect(() => {
        const session = client.auth.session()
        setState({ session, user: session?.user ?? null })
      }, [])
    
      useAuthStateChange((event, session) => {
        console.log(`Supbase auth event: ${event}`, session)
        setState({ session, user: session?.user ?? null })
      })
    
      return <AuthContext.Provider value={state}>{children}</AuthContext.Provider>
    }
  • h

    HarryET

    10/14/2021, 7:57 PM
    Auth Hook:
    Copy code
    ts
    import { AuthContext } from '../components/authProvider';
    import { useContext } from 'react';
    
    export const useAuth = () => {
      const context = useContext(AuthContext)
      if (context === undefined)
        throw Error('useAuth must be used within AuthProvider')
      return context
    }
1...109110111...316Latest