https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How can I setup auth redirects to work for multiple (local, staging, prod) environments?
    b

    Bonteq

    10/22/2022, 6:43 PM
    Now that I've launched my site, I am running into the issue of working with auth while working locally. I've been having to manually get the tokens that are generated on my prod site and pasting them into my localStorage in local. There's gotta be a better way, right?
    t
    s
    • 3
    • 2
  • Database function to handle the creation of new users with Oauth-specific data
    b

    Bonteq

    10/22/2022, 6:49 PM
    I am using a
    Database Function
    alongside a
    Database Trigger
    to generate
    public.users
    in my database whenever a new
    auth.user
    is created. This creation occurs on sign in using
    supabase.auth.signIn({ provider: 'twitch' })
    . The problem I'm hoping to solve is that I'd like to extract additional data from the Twitch provider on account creation, specifically their username. How do I dig into their response further while signing in + creating a user?
    j
    • 2
    • 1
  • How to verify access token at server side with supabase-js?
    v

    vicary

    10/22/2022, 7:15 PM
    When doing SSR, verifying the JWT payload often serves the purpose. According to the docs, the only option at the moment is a call to
    supabase.auth.getUser()
    , is it possible to skip the user fetch and only verify the access token?
    j
    j
    n
    • 4
    • 31
  • Unable to connect fresh install of Supabase and Directus.
    c

    chokeul8r

    10/22/2022, 7:35 PM
    Followed docs here: 3). Next, you will be prompted to input database credentials. Add in the Supabase Database Connection Info noted above as follows: Database Host – The IP address for your database. Port – Port number your database is running on. Database Name – Name of your existing database. Database User – Name of existing user in database. Database Password – Password to enter database. Enable SSL – Select Y for yes or N for no. Root – The root name. https://supabase.com/docs/guides/integrations/directus Getting error : [SELF_SIGNED_CERT_IN_CHAIN] self-signed certificate in certificate chain Please try again ============================= Could use a little help if someone knows what is going south here.
  • Has anyone tried Google Sign In for an app?
    m

    mynamejeff

    10/22/2022, 7:51 PM
    Google OAuth Credentials does not provide a client_secret for Android and iOS apps. Seems they only provide for web apps. Yet Supabase asks for the non-existent secret in the UI. Moreover I cannot use a Web Auth credential for an Android app since it shows an invalid token error?
  • Can I have multiple pools of users in one project?
    v

    vicary

    10/22/2022, 9:34 PM
    I want to migrate a project with a pool of internal users and a separate group of public users in the same project. The users between the two groups may share the same email address. Is it possible in supabase?
    g
    • 2
    • 1
  • Help deciphering auth API error
    j

    jon

    10/22/2022, 9:40 PM
    Hey all! Sending a GET request to
    supabase.auth.getUser()
    is throwing an
    invalid claim: subject missing
    error in my logs and returning a
    500
    on the client. I'm trying to figure out what I might be doing wrong here, but it's sufficiently cryptic that I'm not sure where to start. Could anybody help shed some light? Thanks!
    g
    • 2
    • 2
  • upgreded to supabase v2, but can't see any types from my data?
    l

    Lukas V

    10/23/2022, 12:41 AM
    Before v2, I would add a type next to the .from() method like this:
    Copy code
    const { data, error } = await supabase
        .from<ProductTypeHere>('products')
    But now, it supposed to know the types automatically when initialize client like this:
    Copy code
    import type { Database } from 'types_db';
    
    export const supabase = createBrowserSupabaseClient<Database>();
    But, as you can see from the picture, I get
    any[] | null
    as a return instead of my database type. How can I get return types for my data?
    u
    v
    +2
    • 5
    • 16
  • What is the use case for choosing auth.getSession() over auth.getUser() and vice versa?
    u

    Unknown Member

    10/23/2022, 3:04 AM
    I understand that auth.getSession() retrieves the session, and getUser() retrieves the current user if exists. But since session returns the data containing the session and user, I am not clear as to what the use case is for both, since from my understanding they can pretty much do the same thing, except that getSession can actually refresh the tokens when needed.
    j
    • 2
    • 2
  • signInWithOAuth redirect to not working as expected
    r

    Rocinante

    10/23/2022, 8:32 AM
    I'm trying to implement google & facebook login to my site, but when using the below code it just redirects me to the root
    Copy code
    TS
    const logInWithSocialProvider = (provider: "google" | "facebook") => supabase.auth.signInWithOAuth({
        provider: provider,
        options: {
          redirectTo: `${origin}${$path('/account/oauth/callback')}`,
        }
      });
    a
    • 2
    • 1
  • Missing Prisma migration from Supabase Studio
    b

    bhaybs

    10/23/2022, 8:35 AM
    I am using Prisma and I ran a migration without any errors in the logs (like shown in the image attached) I am supposed to have 8 migrations in total, but Supabase still only shows 7 migrations. I also made sure that the migration wasn't applied either in the associated table I tested the same migration with my localhost postgres, and I didn't encounter any issue. I also tried resetting the database but no data was lost & no new migration was registered Did anyone encounter this situation? I reached out to Supabase support but this is a huge blocker for me at the moment :/ Thank you for your help
    n
    • 2
    • 5
  • JWT auth - session undefined
    l

    Lou | XBorg

    10/23/2022, 9:26 AM
    Hi there, I am trying to authenticate the user with a JWT. while it used to work with setAuth in v1, I can't seem to authenticate the user with the global authorization header in v2. I pass my JWT in the headers, yet, no session get instantiated. getSession return null. When I call client.auth.getUser(token), it returns 500 internal server error. error_id: "aaa46750-3dcb-4f7d-8871-283d4e452dbf" I assume that there is an issue in the way I set my session. Where is the latest documentation on setting up sessions with custom JWTs?
  • Not Connecting new project
    r

    Ricardowj

    10/23/2022, 9:53 AM
    Hello i am have issue with not being able to connect to a new project any suggestions?
    s
    • 2
    • 1
  • Is it possible to access protected tables?
    s

    Shoaib

    10/23/2022, 10:04 AM
    Hello i am new to supabase and i was wondering if it was possible to access protected tables in flutter.
    g
    • 2
    • 1
  • The function size exceeds the allowable limit
    u

    49Ryann

    10/23/2022, 10:39 AM
    Has something changed with the v2 newly released? I have an edge function that now errors out with this, and never used too before. Can't find any info on the issue. or how I could resolve it. is there some limit on the free tier?
    Copy code
    Error: Failed to update an existing Function's body on the Supabase project: {"message":"The function size exceeds the allowable limit"}
    s
    c
    • 3
    • 5
  • Supabae Storage - Export all URL as CSV
    a

    alx90

    10/23/2022, 11:01 AM
    Hey guys, I have 80 files inside my supabase storage and I want to export them as csv. I need to code it by myself or there is a function for it in the gui/webpage?
  • RLS Policy not working with JWT (Auth0)
    s

    Smyrii

    10/23/2022, 12:00 PM
    Hello all, I'm having issues getting RLS working when sending a JWT to Supabase. I'm signing the JWT with he Supabase signing secret and sending the payload as shown below:
    Copy code
    const payload = {
        userId: session.user.sub,
        exp: Math.floor(Date.now() / 1000) + 60 * 60,
      };
    
      session.user.accessToken = jwt.sign(
        payload,
        process.env.SUPABASE_SIGNING_SECRET
      );
    I'm sending the JWT (access token) when trying to get table data
    Copy code
    async getServerSideProps({ req, res }) {
        const {
          user: { accessToken },
        } = await getSession(req, res);
    
        const supabase = getSupabase(accessToken);
    
        const { data: notes } = await supabase.from("Notes").select("*");
        return {
          props: { notes },
        };
      },
    But even when there user_id should match and return some results it does not. Here is my SQL below:
    Copy code
    create or replace function auth.user_id() returns text as $$
      select nullif(current_setting('request.jwt.claims', true)::json->>'userId', '')::text;
    $$ language sql stable;
    and my select policy
    Copy code
    (user_id() = user_id)
    Any idea's on why this won't work? Thanks!
    g
    • 2
    • 6
  • Cannot connect to the Docker daemon on macOS
    d

    doxara

    10/23/2022, 12:01 PM
    I was just following this guide (https://supabase.com/docs/guides/cli/local-development) on setting up local development environment with Supabase CLI and got stuck on running the Docker instance. What have I done: 1. Installed Docker for Mac OS (https://docs.docker.com/desktop/install/mac-install/) 2. Run supabase login 3. Run supabase init from my terminal 4. Run supabase start Then I got the following error: Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? I tried restarting Docker instance, terminal, OS, login to Docker etc. but nothing helped.
    l
    t
    • 3
    • 5
  • supabase-flutter 1.0.1 refresh token gone
    t

    thomas_mol

    10/23/2022, 12:58 PM
    When I'm idling in my flutter app with supabase-flutter 1.0.1 I receive this error:
    Copy code
    flutter: ***** SupabaseDeepLinkingMixin startAuthObserver
    [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: AuthException(message: refresh_token required, statusCode: 400)
    #0      GotrueFetch.request
    package:gotrue/src/fetch.dart:99
    <asynchronous suspension>
    #1      GoTrueClient._callRefreshToken
    package:gotrue/src/gotrue_client.dart:588
    <asynchronous suspension>
    Seems to be a problem getting a refresh token. This happens when I do nothing in the app (just have it open, not interacting with the app at all). Any ideas?
    • 1
    • 1
  • nextjs auth wihtout helpers
    c

    Captain

    10/23/2022, 1:02 PM
    i am trying to implement as simple nextjs auth with supabase. just signup with email and password and signin with email and password. i dont want to use any frontend stuff. i want to do it with nextjs api routes. i can sign up the user and i get the sesison returned, but i cant persist it in the cookie. how do i achieve this? this is my code
    Copy code
    javascript
    try {
            const { data, error } = await supaClientAnon.auth.signUp({
                email,
                password
            });
    
            if (error) {
                res.status(422).json({ message: error.message });
                return;
            }
    
            const sess = await supaClientAnon.auth.setSession(data?.session as Session);
    
            return res.status(201).json({ message: 'Signed up!', data, sess });
    
    
        } catch (error) {
            res.status(500).json({ message: 'Something went wrong' });
            return;
        }
    j
    n
    +2
    • 5
    • 136
  • HCaptcha + supabaseauth-ui-react integration
    t

    talpiven

    10/23/2022, 3:22 PM
    Is there a way to integrate the HCaptcha option with supabaseauth-ui-react npm package
    s
    • 2
    • 3
  • Which type should I use for the Realtime channel payload?
    v

    VWL Tobias Hassebrock

    10/23/2022, 4:07 PM
    If I try to use the new Realtime Channel and access the "record" property then I get an error saying "Property 'record' does not exist on type 'RealtimePostgresUpdatePayload'." Why is that?
  • user being fetched only after browser tabs changed.
    s

    Solemensis

    10/23/2022, 8:41 PM
    after login, the uservalue is shown on the page, but immedietaly gone after refreshing page or changing route. and it's being fetched back again only after browser tabs changed. And if you reload page or go to another route, it'll hide again. You need to change tabs again to show it. It doesn't happen this way on localhost. Only on netlify etc. The hosted buggy website: https://luminous-haupia-12c8f2.netlify.app/login try to login with: mail: myauthtest23@outlook.com // pass: 123321 or create your own account and login with it. After login, there should be uservalue written on page if there's a user. So after login, it shows up, but gone after route change or website reload. And, it comes back after tab changes. I've recorded a vid:

    https://www.youtube.com/watch?v=SOTzkS08YIs&ab_channel=Clarity▾

    Here's the repo of this website to reproduce: (no .env included) https://github.com/Solemensis/supabase-nuxt-login_bug
  • how to save data from an other API crud-app
    a

    Axelbgds

    10/23/2022, 6:49 PM
    Hi there !! Could you help me regarding this subject please : I want to save data from an API like CoinMarketCap for my study. Do you have any idea I read a lot of things in the documentation for this moment I find nothing. My goal : take some data from the api cmc and join the data for an other base like user in Supabase and show how qty users have in crypto or something like that… For this moment I see some subjects to connect the data from Supabase in React project … Maybe it’s not possible to do this but I don’t thing. And more if you have any idea for realize graphics I will take it. Many thanks for you help 👍 Axel
    d
    • 2
    • 3
  • Is it possible for the page to get the Auth state from auth-ui-react helper?
    f

    freshandlow

    10/23/2022, 8:05 PM
    I'm loving the new auth-ui helpers but think I might be missing something obvious - having themed up the component on a login page, I gain the sign up and forgot password screens, but these are all rendered from the same component... At the moment the header on the page is a static "Sign into your account" - my question is if/how I can determine which state the Auth component is in and hence change the header text to reflect the state - i.e. "Sign up to create an account" as the header when the Sign Up form is being rendered? Thanks
    s
    • 2
    • 3
  • initialize supabase client once (cached) or multiple times?
    k

    kuroro

    10/23/2022, 8:49 PM
    Lets say on the server, i have an API handler that needs to return user data using supabase. Should i call
    createClient
    during each request? Or should I only call it once and then cache the object for further use in subsequent requests? I guess this is meant for non-serverless setups where each request is handled on same process.
    j
    • 2
    • 3
  • Error RealtimeChannels - occurred when joining realtime table=eq id
    v

    VWL Tobias Hassebrock

    10/23/2022, 8:56 PM
    I updated to v2 today, changed the syntax of the realtime subscriptions, deactivated RLS policies and now I get the following websocket error if I subscribe to a RealtimeChannel:
    Copy code
    event: "phx_reply"
    
    payload: 
    response: {reason: "error occurred when joining realtime:public:<table-name>"}
    
    reason: "error occurred when joining realtime:public:<table-name>"
    
    status: "error" 
    
    ref: "1"
    topic: "realtime:public:<table-name>"
    Any ideas what could cause this? I also found this bug report on github but I do not understand it: https://github.com/supabase/realtime/issues/217 I also created a stackoverflow post: https://stackoverflow.com/questions/74175531/supabase-realtime-error-occurred-when-joining-realtimepublictable-name
    g
    • 2
    • 26
  • docs in default browser font?
    e

    endigma

    10/23/2022, 10:56 PM
    on firefox/linux the docs show entirely in the default document font which is times/equiv, very unreadable, on macos it seems to default to sf ns, which seems like how this may have gone unnoticed? a default selection of "sans-serif" at least should be set to avoid defaulting to serif, although i'd recommend picking a proper font
    • 1
    • 2
  • Why does my query return null on page refresh?
    a

    Austin

    10/23/2022, 11:48 PM
    This may be my ignorance of React, but I'm able to sometimes render database records to populate a table, but after refreshing the page my query returns null. Could y'all help me figure out what's happening? Code attached
    j
    d
    • 3
    • 12
  • Does auth.getUser() internally invoke the getSession() method?
    u

    Unknown Member

    10/23/2022, 11:49 PM
    Just wondering if it does, does it also inherently refresh the session if the session is invalid?
    g
    • 2
    • 1
1...515253...230Latest