https://supabase.com/ logo
Join DiscordCommunities
Powered by
# javascript
  • g

    garyaustin

    04/20/2022, 1:31 PM
    random order
  • a

    asyncink

    04/20/2022, 6:51 PM
    Hi guys and Supabase team! I've been working with Supabase and Next for a few months building isomorphic e-commerce application. As far as I can tell now, it's not possible to build an entire application using only Supabase client and Next. The blocker is that the Supabase client is only accessing the database from the client side β€” so I can not deal with things like placing orders, creating transactions or user notifications from client side. Even with anon key every user can generate notifications for himself and these notifications will be valid. To do so, user don’t even need to dig into source code, just open browser dev tools and find the request. Having this request user is able to repeat it with curl, changing the parameters as he likes. Same thing with placing orders, changing account balance, etc. Next offers API Routes for this, so I can isolate all necessary logic on server side and user will not be able to bypass server side checks. But Supabase client is not working server side so it is not the solution. And then it turns out that Supabase is not an alternative to Firebase, with which you can build application, but a replacement for database providers such as Atlas. Convenient way to get database up and running. Am I wrong and missing something? And how do you solve this issues in your projects?
    i
    n
    • 3
    • 6
  • i

    Infrapuna

    04/20/2022, 9:12 PM
    Hi guys and Supabase team
  • a

    Afranche

    04/20/2022, 10:52 PM
    Hello there! πŸ‘‹ Sorry to bother, I'm wondering what did I do wrong on a Nuxt 3 project while attempting authentication through a social provider. In simple terms, I've configured a Discord app properly and used https://supabase.nuxtjs.org to implement the rest. From there my login method looks like this:
    Copy code
    ts
    const { user, error } = await client.auth.signIn({ provider: "discord" });
    Everything goes pretty well in the OAuth2/OIDC flow. I'm redirected at the root of my application with the tokens:
    http://localhost:3000/login#access_token=[...]&provider_token=[...]&refresh_token=[...]&token_type=bearer
    . Everything from there looks fine but what I'm left with is a 401 error stating
    Invalid authentication credentials
    on an AJAX call. I'm failing to a similar case while searching on Google so I'm reaching out here to know if anyone might have run into the same issue. Thanks a lot! πŸ™‚
  • s

    Scott Prins

    04/21/2022, 6:33 PM
    Looking for some help writing supabase db/subscribe queries needed for a messaging feature. The auth users are from a firebase DB, so I have a reference table in supabase for users holding just the ID, and first/last name. I need to be able to query conversations for a specific user, messages in a specific conversation referencing the current user, and to post messages to the messages column, which the last one should be simple. For Context I have 4 tables:
    Copy code
    conversations{
      id,
      created_at
    }
    
    conversation_members {
      id,
      user_id (FK: user.id)
      conversation_id (FK: conversation.id)
      joined_time,
      left_time,
      created_at
    }
    
    messages {
      id
      conversation_id (FK:conversation.id)
      from_id (FK: user.id)
      body,
      timestamp
    }
    
    users {
      id
      first_name
      last_name
    }
    I have tried this with Firebase with just a "Conversations" collection and a nested array of messages, but it was inefficient as hell and not scalable at all, so Relational database was my next option here, but I am having trouble writing the queries to make it happen effectively
    g
    • 2
    • 5
  • g

    garyaustin

    04/22/2022, 12:24 AM
    conversation and messages help
  • f

    fachofacho

    04/22/2022, 11:00 PM
    https://github.com/supabase/supabase/issues/6509 - have got the same issue. get the access token from supabase, but login with google returns null session null user etc...
  • f

    fachofacho

    04/22/2022, 11:01 PM
    it doesn;t work for me on mozilla as well
  • f

    fachofacho

    04/22/2022, 11:06 PM
    { provider: "google", url: "https://xfzuuyrhuwjnxfzhhgpo.supabase.co/auth/v1/authorize?provider=google", data: null, session: null, user: null, error: null } this is the response I get
  • j

    joshcowan25

    04/23/2022, 8:31 AM
    Has anyone use Supabase and Algolia together?
  • r

    RyanHirsch

    04/23/2022, 2:31 PM
    I'm trying to use the realtime capabilities and it won't work for one of my tables. For one table its working just fine, for the other one I'm getting no events back. The UI shows both are toggled on, I am not using RLS.
    g
    • 2
    • 23
  • b

    bobmolgui

    04/23/2022, 3:24 PM
    Probably I miss something or are there some error in the reference documentation? When I try to use https://supabase.com/docs/reference/javascript/auth-api-updateuserbyid I receive the error that this function is not available. Anyone else here with the same problem or any advice how to fix this?
    g
    a
    • 3
    • 10
  • a

    Albert [tox/cis]

    04/23/2022, 3:25 PM
    I've had something similar and after a few hours of debugging I noticed that I was calling that function on the wrong auth api of supabase
  • a

    Albert [tox/cis]

    04/23/2022, 3:26 PM
    Ah, right. It's only server-side. Are you working with javascript on the server?
  • a

    Albert [tox/cis]

    04/23/2022, 3:26 PM
    See the
    auth
    above
  • b

    bobmolgui

    04/23/2022, 3:27 PM
    Yes it's a nodejs backend and I want to use the supabase-js client. Any tipps?
  • a

    Albert [tox/cis]

    04/23/2022, 3:27 PM
    You're calling it in the backend?
  • a

    Albert [tox/cis]

    04/23/2022, 3:27 PM
    Not on the client right?
  • b

    bobmolgui

    04/23/2022, 3:28 PM
    yes over the supabase-js client with the api-key (service_role).
  • g

    garyaustin

    04/23/2022, 3:30 PM
    updateUserById() | Supabase
  • l

    Luc

    04/23/2022, 6:10 PM
    Hey guys, I have a question, about using SUPABASE PROVIDER AUTH in nextjs. When I want to authenticate, supabase redirects me to a url that doesnt exist. Is there any way to signin with popup, or to fix te issue.
    s
    • 2
    • 2
  • a

    arcavid

    04/24/2022, 1:21 AM
    Anyone having problem using supabase client with service key on api routes (supabase.js, next.js) on Vercel production? It works fine on local. I keep getting this error:
    Client network socket disconnected before secure TLS connection was established
    It used to work fine until yesterday.
  • b

    Bryson_W

    04/24/2022, 5:04 AM
    Same man - it works in dev but in prod I’m getting supabase key required
  • b

    Bryson_W

    04/24/2022, 5:05 AM
    I’ve tried everything but the last thing i just read is to put the variables in next.config too
  • a

    arcavid

    04/24/2022, 7:54 AM
    Does that do the trick? I thought storing them in Vercel dashboard's environment vars section was enough.
  • a

    arcavid

    04/24/2022, 7:55 AM
    It's weird because, for me, it had been working flawlessly until yesterday night.
  • a

    arcavid

    04/24/2022, 7:56 AM
    and can you give me the link that says so?
  • l

    Luc

    04/24/2022, 11:02 AM
    When I used Firebase, all i had to do to stay logged in was
    onAuthStateChanged
    . Supabase also provides the same function but when I refresh the page, it doesnt log `authenticated`(for example).
    Copy code
    ts
      const onStartup = async () => {
        try {
          console.log(client.auth.session())
    
          client.auth.onAuthStateChange((event, session) => {
            if (event == "SIGNED_IN") {
              return console.log("SIGNED_IN", session)
            }
            console.log("nione", session)
          })
        } catch (error) {
          console.log(error)
        }
      }
    How can I keep user logged in, even if i refresh the page?
    • 1
    • 2
  • b

    Bryson_W

    04/24/2022, 2:41 PM
    I seen it on a stack over flow post
  • b

    Bryson_W

    04/24/2022, 2:42 PM
    @arcavid And for older versions of next that step was needed I believe but I'm trying everything lmao, bout to deploy to prod and I'll let you know
1...585960...81Latest