https://supertokens.com/ logo
Docs
Join the conversationJoin Discord
Channels
community
contributing
general
github-activity
info
introductions
new-releases
random
security
support-questions
welcome-0xdelusion
welcome-aj-ya
welcome-aleksandrc
welcome-alpinjs
welcome-amberlamps1
welcome-andrew-rodriguez
welcome-ankit-choudhary
welcome-anthony-stod-custodio
welcome-call-in
welcome-chwalbox
welcome-claybiokiller
welcome-co7e
welcome-cosmoecwsa
welcome-devdag
welcome-dinso
welcome-drebotelho
welcome-elio
welcome-ernest
welcome-foxbarrington
welcome-fromscratch
welcome-galto4ir
welcome-goetzum
welcome-hay-kot
welcome-himanshu-kukreja
welcome-hossambarakat
welcome-ichikawakazuto
welcome-jahir9991
welcome-jamesl
welcome-jerry123424
welcome-john-oliver
welcome-jonas-alexanderson
welcome-jxyz
welcome-kelvinwop
welcome-kraz
welcome-lancekey
welcome-leoo
welcome-lukeacollins
welcome-m-j-mon
welcome-malik-khoja
welcome-marco
welcome-mardadi
welcome-meshguy
welcome-metamorph
welcome-mike-tectu
welcome-mirzok
welcome-mozomig
welcome-naberyou66_
welcome-nacer
welcome-namratha
welcome-naveenkumar
welcome-nightlight
welcome-nischith
welcome-notankit
welcome-olawumi
welcome-pavan-kumar-reddy-n
welcome-pineappaul
welcome-poothebear
welcome-rick
welcome-samuel-qosenergy
welcome-samuelstroschein
welcome-shubhamgoel23
welcome-shubhamkaushal
welcome-sidebar
welcome-surajsli
welcome-suyash_
welcome-syntaxerror
welcome-tauno
welcome-tauno
welcome-tawnoz
welcome-teclali
welcome-tls
welcome-turbosepp
welcome-vikram_shadow
welcome-yann
Powered by Linen
support-questions
  • r

    rp

    06/28/2021, 7:48 AM
    with some known delimiter
  • r

    rp

    06/28/2021, 7:50 AM
    See this answer: https://stackoverflow.com/a/27413325/3867175
  • n

    nim4ze

    06/28/2021, 8:13 AM
    top, thanks!
  • n

    nim4ze

    06/28/2021, 5:40 PM
    Hi, is there an easy way to define execute callback functions in the frontend upon signin apart from those made for the analytics calls? As in a custom behaviour so that I could hide elements which should only be visible for logged out users.
  • r

    rp

    06/28/2021, 5:41 PM
    So you want to essentially check if a user is logged in, and if they are, you want to hide some elements?
  • n

    nim4ze

    06/28/2021, 5:44 PM
    Yes, I have a ReactDOM.render which contains the router a NavBar and EmailPasswordAuth. Upon login I want to hide / remove the navbar from the DOM as I'd like to display a different navbar, which is contained in my App (encapsulated in the EmailPasswordAuth).
  • r

    rp

    06/28/2021, 5:44 PM
    Cool! So check this out: https://supertokens.io/docs/emailpassword/common-customizations/sessions/checking-session-front-end
  • r

    rp

    06/28/2021, 5:46 PM
    Also, are you wrapping your entire app with
    EmailPasswordAuth
    component?
  • r

    rp

    06/28/2021, 5:47 PM
    I have DM'd you as well - if you could please see that, it would be very helpful :))
  • n

    nim4ze

    06/29/2021, 2:46 PM
    Hi, when we navigate to our app to the site which has the supertokens login form, it will automatically append
    /auth?rid=emailpassword&redirectToPath=%2F
    to the domain. As this is in the URL, when a user then refreshes the page a 404 page is shown. Is there a way to turn off the automatic appending of the parameters?
  • r

    rp

    06/29/2021, 2:47 PM
    A 404 should not be shown if a user refreshes the page on that URL
  • r

    rp

    06/29/2021, 2:48 PM
    can you maybe explain the user flow little more clearly?
  • r

    rp

    06/29/2021, 4:43 PM
    @User , just a recap of the solution to the 404 issue: You need to configure your backend webserver routing to server the
    index.html
    file regardless of which path the user visits via their browser. Hope this solves your issue :))
  • u

    user

    06/30/2021, 8:53 AM
    How to override the React components generated using
    SuperTokens
    from
    supertokens-auth-react
    ? In docs there exists one for
    ThirdPartyEmailPassword
    https://supertokens.io/docs/thirdpartyemailpassword/advanced-customizations/react-component-override/usage But the same
    override
    didn't work for
    SuperTokens.init(...)
  • r

    rp

    06/30/2021, 8:54 AM
    Can you share your code please?
  • u

    user

    06/30/2021, 8:55 AM
    SuperTokens.init({
      appInfo: {
        // learn more about this on https://supertokens.io/docs/thirdpartyemailpassword/appinfo
        appName: "S",
        apiDomain: END_POINT,
        websiteDomain: window.location.href,
        apiBasePath: "/api/auth",
      },
      recipeList: [
        ThirdPartyEmailPassword.init({
          signInAndUpFeature: {
            providers: [],
          },
          onHandleEvent: async (context) => {
            if (context.action === "SUCCESS") {
              store.dispatch(getProfilesFromDb);
            }
          },
    
          override: {
            components: {
              SignInHeader: (OriginalComponent) => (originalProps) => {  
                console.log("signinheader")
                return (
                    <div>
                        <h1> text1</h1>
                        <img src="https://s.ai/logo_full.svg" />
                        <OriginalComponent {...originalProps} />
                    </div>
                );
            },
    
            EmailPasswordSignIn: (OriginalComponent) => (originalProps) => {
              return (
                  <div>
                       <h1>text2</h1>
                      <OriginalComponent {...originalProps} />
                  </div>
              );
            },
         
          }
          }
        }),
        Session.init(),
      ],
    });
  • u

    user

    06/30/2021, 8:58 AM
    In simpler words, I want to add a logo and change the header text of this React component.
  • r

    rp

    06/30/2021, 9:03 AM
    let me check..
  • r

    rp

    06/30/2021, 9:16 AM
    So you might want to try this:
    ThirdPartyEmailPassword.init({
      signInAndUpFeature: {
        style: {
          headerTitle: { display: "none" }
        },
        ...
      },
      override: {
        components: {
          ThirdPartyEmailPasswordHeader: (OriginalComponent) => (originalProps) => {
            return (
              <div>
                <h1>text1</h1>
                <img src="https://s.ai/logo_full.svg" />
                <OriginalComponent {...originalProps} />
              </div>
            );
          }
        }
      }
    }
    - You need to override
    ThirdPartyEmailPasswordHeader
    component (which will affect the sign in and sign up pages. - You need to hide the current title by using
    headerTitle: { display: "none" }
    as seen above.
  • u

    user

    06/30/2021, 9:18 AM
    Thanks, Will try this and let u know
  • r

    rp

    06/30/2021, 9:19 AM
    And in your custom component, you can check if the current screen is sign up or not by using
    originalProps.isSignUp
    boolean
  • s

    sahil-shubham

    06/30/2021, 9:26 AM
    Hi there! Does Supertokens has any kind of session id which can be used to differentiate between two logged out users? I wanted to store some data regarding what different users search for. In the case of signed in users, I can store the hash of the userId but this isn't possible for other users.
  • r

    rp

    06/30/2021, 9:26 AM
    we don't have anonymous sessions yet 😦
  • r

    rp

    06/30/2021, 9:27 AM
    But you can set some random ID for each user in their cookies - regardless of if they are logged in or not (when they first visit the site).
  • r

    rp

    06/30/2021, 9:28 AM
    If they are logged in, then you can continue to use supertokens' session to ID them. Else, you can use the random ID you had put in their cookies.
  • u

    user

    06/30/2021, 6:38 PM
    I have tried the same code. But the `override`is not working. The
    headerTitle: { display: "none" }
    works well But in override, we tried changing the components like
    SignInHeader
    ,
    EmailPasswordSignIn
    . But nothing worked
  • r

    rp

    06/30/2021, 8:05 PM
    @User which version of supertokens-auth-react are you using?
  • r

    rp

    06/30/2021, 8:06 PM
    Because I tried the code on the demo app we have, and it works. I copy / pasted the code from there into discord
  • s

    sahil-shubham

    07/01/2021, 4:05 AM
    0.13.0
  • s

    sahil-shubham

    07/01/2021, 4:05 AM
    Should we upgrade to another version?
Powered by Linen
Title
s

sahil-shubham

07/01/2021, 4:05 AM
Should we upgrade to another version?
View count: 2