https://supabase.com/ logo
Join Discord
Powered by
# python
  • w

    wolfie's dad

    08/06/2022, 2:45 PM
    Hello, im trying to authenticate a user on my python backend with the following code:
    Copy code
    url: str = os.environ.get("SUPABASE_URL")
        key: str = os.environ.get("SUPABASE_KEY")
    
        supabase: Client = create_client(url, key)
        user = supabase.auth.api.get_user(jwt=token)
    but api returns me 401 unauthorized. The token i am using is the access_token that my mobile client is sending me after a user logs in with OTP
  • w

    wolfie's dad

    08/06/2022, 2:46 PM
    Confused why im getting 401 unauthorized if the key im using for SUPABASE_KEY is the one i got from supabase console in Project API keys
  • v

    Vinzent

    08/06/2022, 7:12 PM
    get_user on python backend
  • j

    jaitaiwan

    08/15/2022, 5:50 AM
    @wolfie's dad depends on which key you’re using. Get user might require the admin key…
  • p

    ProtoFeather

    09/02/2022, 12:05 PM
    Hi guys! I'd like to make sure the database is up and running before starting my app, how could I assert this? (I'm working from time to time on a project and most of the times, the database is on hold)
  • m

    mauro_vit

    09/22/2022, 4:59 PM
    hello everyone! Is there someone that is having problems reading data from a table when rls is set ?
  • m

    mauro_vit

    09/22/2022, 5:01 PM
    I'm 100% sure that the sign_in method works correctly and I'm authenticated but the supabase sdk return an empty list for the table that has rls setted
  • m

    mansueli

    09/22/2022, 9:34 PM
    hello everyone Is there someone that is
  • c

    capezolo

    09/23/2022, 6:19 AM
    Hi. Is there a long form tutorial anywhere for how to use supabase auth with a Flask app?
  • m

    mauro_vit

    09/23/2022, 11:46 AM
    for all developers that are having the same problem that I had yesterday: - when u ask for data to your db and you are under authentication, if you have the rls policies setted, calling the sign_in method is not enough, you also need to set the access token manually. For example:
    Copy code
    def main():
        supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
        email: str = "test@test.com"
        password: str = "test"
            
        session = supabase.auth.sign_in(email=email, password=password)
        supabase.postgrest.auth(session.access_token)   # <-- this line make it works
  • o

    Olyno

    09/23/2022, 4:11 PM
    Hi Can you edit your message to detail what your code solves? So i can pin it in the channel :p
  • o

    Olyno

    09/23/2022, 4:12 PM
    Or better, transfer your message in the thread, so i can pin it in the thread directly 😄
  • m

    mauro_vit

    09/25/2022, 5:22 PM
    Auth with rls policies
  • m

    mauro_vit

    09/25/2022, 5:23 PM
    @Olyno Hi! I did it, let me know if it is ok!
  • z

    ZetiMente

    09/27/2022, 6:56 PM
    Hi, can someone take a look at my PR https://github.com/supabase-community/supabase-py/pull/275 ? J0 has updated realtime to version 5. However, need to add it to the python package in order to use Web sockets 11.3 and Python 3.10 with the Supabase client.
  • j

    JustinT

    10/05/2022, 5:32 AM
    Has anyone gotten REALTIME to work locally on python? I have been at this for a few hours and cant get it to work with supabase cli
  • j

    JustinT

    10/05/2022, 5:41 AM
    I am having trouble just getting the basic example to work local or on the remote
    Copy code
    def callback1(payload):
        print("Callback 1: ", payload)
    
    
    if __name__ == "__main__":
        URL = f"wss://{SUPABASE_ID}.supabase.co/realtime/v1/websocket?apikey={API_KEY}&vsn=1.0.0"
        s = Socket(URL)
        s.connect()
    
        channel_1 = s.set_channel("realtime:*")
        channel_1.join().on("INSERT", callback1)
        s.listen()
    all I get is this 2022-10-05 01:38:16,452:INFO - Connection was successful
  • b

    baderdean

    10/10/2022, 12:04 PM
    Hello, did someone found an elegant way to transform many related tables rows in a json tree? For instance in schema.org JSON-LD schemas there is Persons, Organization, Places (Person n:1 Organization 1:n Place). What I would like is to query a Person and get the whole tree in JSON without a lot of boilerplate code to request every table.
  • a

    anand

    10/10/2022, 3:06 PM
    fwiw neither have I, all the sync wrappers around async
    websockets
    methods was really buggy when i tried it a few months back, imo we should get rid of the sync API and only expose an async itnerface. realtime has been on the backburner lately and it's about time we worked on it 😄
  • j

    JustinT

    10/10/2022, 11:20 PM
    lol thanks for getting back to me. no worries - I think I am going to give up on Python all together and just write everything in typescript
  • j

    JustinT

    10/10/2022, 11:20 PM
    🙃
  • m

    mynamejeff

    10/13/2022, 3:10 PM
    What's the issue you're facing? It wasn't exactly clear from your discussion. Pitching in because I too faced issues with Realtime and was able to solve them after a little bit of help from the contributor team.
  • a

    Anukul Anand

    10/13/2022, 6:54 PM
    However the data for the id = 7 gets deleted. But is this error that I'm getting please help
  • m

    mynamejeff

    10/14/2022, 7:36 AM
    Hi Anukul, have you enabled RLS? If so, have you created any policy so that Anon users can access your database? It would be helpful if you added a few print statements in your code for debugging purposes.
  • m

    MindsetFPS

    10/14/2022, 7:54 AM
    hello there! is the or() method available in the python library? basically i want to reproduce this example from the javascript libray
    Copy code
    const { data, error } = await supabase
      .from('countries')
      .select('name')
      .or('id.eq.2,name.eq.Algeria')
  • g

    garyaustin

    10/14/2022, 2:14 PM
    from their open issues : https://github.com/supabase-community/postgrest-py/issues/137
  • r

    Rawa

    10/17/2022, 5:28 PM
    Hey
  • r

    Rawa

    10/17/2022, 5:28 PM
    Just opened a PR, https://github.com/supabase-community/supabase-py/pull/289
  • r

    Rawa

    10/17/2022, 5:28 PM
    Appreciate if someone takes a look.
  • a

    Anukul Anand

    10/18/2022, 7:17 PM
    Sure! I have managed to remove the errors
1...1516171819Latest