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

    Gabriel Santos

    08/13/2021, 6:52 PM
    how can i change the default (authenticated) role of a user? I would like to separate admins from users with roles, but I don't know how to do that.
    s
    • 2
    • 2
  • l

    Lautaro Pereyra

    08/13/2021, 6:55 PM
    Roles within the table users are for database level permissions or something like that. In your case, you should create a group table with a Group for "Administrators" and another Members table to link users with groups.
  • g

    GandalfG

    08/13/2021, 7:17 PM
    Awesome thnks a lot Rob
  • k

    Khan W

    08/13/2021, 8:26 PM
    is the ILIKE query documented anywhere? I only see the .eq documented in the realtime docs and the js docs
  • m

    Maus

    08/13/2021, 8:38 PM
    https://postgrest.org/en/v7.0.0/api.html#operators I only saw just now u should use
    *
    instead of
    %
  • t

    touhidrahman

    08/13/2021, 8:39 PM
    Hi guys, this is probably a beginner question but I couldn't find an answer from either supabase or PostgREST documentation. I have a view like the following, where categories are combined from a JOIN:
    Copy code
    products
    =========
    id | name | categories
    ---|------|-------------------------------
    1  | A    | ["Men", "Shirts", "Business"]
    2  | B    | ["Women", "Dress", "Casual"]
    Now, I would like to select only rows that contain
    category=Shirts
    . How can I do that?
  • k

    Khan W

    08/13/2021, 8:39 PM
    https://supabase.io/docs/reference/javascript/contains Something like this
    Copy code
    javascript
    const { data, error } = await supabase.from("products")
      .select("*")
      .contains("categories", ["Shirts"])
  • k

    Khan W

    08/13/2021, 8:40 PM
    oooh so all the postgrest operators just translate to Realtime?
    s
    • 2
    • 4
  • t

    touhidrahman

    08/13/2021, 8:42 PM
    Nice! Thanks. I am gonna try that now.
  • k

    Khan W

    08/13/2021, 8:42 PM
    Totally!
  • r

    RB_Gaura

    08/13/2021, 10:19 PM
    anyone know how I can filter and select based on dates?
  • s

    soedirgo

    08/14/2021, 3:24 AM
    Realtime filters
  • b

    bim

    08/14/2021, 4:52 AM
    I'm having a little issue with auth and redirects. All my pages should be gated by login. I've built a
    ProtectedRoute
    component that checks if there is a user logged in and whether the path is protected, and will
    router.push
    to /login accordingly. The issue im having is that after
    await supabase.signIn()
    is called, I’m being redirected to my homepage, but after the redirect
    supabase.auth.user()
    is still
    null
    , and my
    ProtectedRoute
    component is then redirecting back to /login. If I enter the url to go to the home page again, it won’t redirect me and
    user
    is no longer
    null
    . In other posts I saw
    onAuthStateChange
    suggested to be used. But I am already using an AuthProvider similar to the examples that utilise
    onAuthStateChange
    . I think in my case it may be that the change in path is triggering a redirect before the user state is changed. But I'm not sure how to fix this. I see in a few examples people redirect with getServerSideProps. But if I did this, wouldn't all of my pages would go from client side rendering to SSR, and I’m not sure if that would benefit me since I'm not interested in SEO. Although I’m not a fan of the loading page flash that occurs when a protected route is being client side redirected to the login page.
    s
    • 2
    • 2
  • p

    pveyes

    08/14/2021, 8:28 AM
    anyone know if it's possible to combine OR with textSearch? I have
    name (varchar)
    and
    notes (text)
    field and I wanted to use
    ilike
    in
    name
    and
    textSearch
    in
    notes
    ?
  • d

    donpuerto

    08/14/2021, 1:23 PM
    How to OVERRIDING SYSTEM VALUE in supabase? **Error {hint: "Use OVERRIDING SYSTEM VALUE to override.",…} code: "428C9" details: "Column "id" is an identity column defined as GENERATED ALWAYS." hint: "Use OVERRIDING SYSTEM VALUE to override." message: "cannot insert into column "id""
  • u

    2% space milk

    08/14/2021, 2:47 PM
    My knowledge on SQL is limited. What can I search up to add some sort of validation for incoming data?
  • o

    oe

    08/14/2021, 6:17 PM
    Is there currently any way to pass your db schema types for typescript?
  • f

    florian-lefebvre

    08/14/2021, 7:21 PM
    You can generate types: https://supabase.io/docs/reference/javascript/generating-types
  • o

    oe

    08/14/2021, 8:11 PM
    Oh, thanks! Somehow missed that 😅
  • u

    65536william

    08/14/2021, 9:00 PM
    I have a question for postgres policy experts. If a table has RLS and SELECT is restricted to
    user_id
    (let's say), is there any way to INSERT a row and SELECT the uuid from the row you just inserted, without 'passing' the RLS policy?
  • u

    65536william

    08/14/2021, 9:01 PM
    I'm trying to grab the supabase-generated id of a row for a user who does not have permission to SELECT that row... it seems like it's possible to INSERT but not collect the id.
  • d

    Di

    08/14/2021, 9:10 PM
    Has anyone been able to set up a skeema-like workflow? How are y'all doing DB migrations?
  • s

    Shubham-Sinha

    08/15/2021, 5:03 AM
    I am trying to use Supabase with React Native. Should I follow https://supabase.io/docs/guides/with-react or is there something specific to React Native?
  • u

    user

    08/15/2021, 6:56 AM
    just resumed a project and the domain is NXDomaining. anyone know what i can do?
  • f

    florian-lefebvre

    08/15/2021, 8:17 AM
    I think this guide will be fine
  • j

    jbergius

    08/15/2021, 2:11 PM
    I’m building an application with NextJS and have some API routes that I need to protect in some way. Is it possible to use the JWT I get back after login to verify that the request comes from a authenticated user with a valid JWT? I guess it would be possible if I could verify the JWT in the API routes. But with what key should I verify the JWT with?
  • r

    romlytech

    08/15/2021, 2:22 PM
    this is what i do:
    Copy code
    // verify user is authenticated first
      const token = event.headers.token;
      const body = JSON.parse(event.body);
    
      const { data: user, error: user_error } = await supabase.auth.api.getUser(
        token
      );
    
      console.log(user);
    
      if (user_error) {
        return {
          statusCode: error.status,
          body: JSON.stringify({ message: error.message }),
        };
      }
  • j

    jbergius

    08/15/2021, 2:22 PM
    Ah never mind. Think I found it myself. Just needed to rubber duck 😉 for anyone else wondering you can find the JWT Secret in the Supabase UI. Think that will work.
  • j

    jbergius

    08/15/2021, 2:24 PM
    Aah thanks. Another option as well! So user_error is null if the JWT is still valid I guess?
  • r

    romlytech

    08/15/2021, 2:26 PM
    yeah I mean it works so far. honestly I haven't put much thought or further dev into it since... it works and I had larger priorities lol
1...505152...316Latest