Hi, I'm using prebuilt UI from supertokens. I'm tr...
# support-questions
d
Hi, I'm using prebuilt UI from supertokens. I'm trying to connect backend to MySql DB, but I'm having basic error (POST method in signin up or signin in) I'm using NodeJS and React in frontend
n
Hi @DavidK , Can I see the config you use when initialising SuperTokens on the frontend and backend?
d
Copy code
import EmailPassword from "supertokens-node/recipe/emailpassword";
import Session from "supertokens-node/recipe/session";
import { TypeInput } from "supertokens-node/types";
import Dashboard from "supertokens-node/recipe/dashboard";

export const SuperTokensConfig: TypeInput = {
    supertokens: {
        // this is the location of the SuperTokens core.
        connectionURI: "https://2c93283155d511ed82687d99624be41d-eu-west-1.aws.supertokens.io:3573",
        // connectionURI: "http://localhost:3567",
        apiKey: "jLc-owsMYZMSzGSdo5PKnvZsnoQz8J"
    },
    appInfo: {
        appName: "todo-lista",
        apiDomain: "http://localhost:3001",
        websiteDomain: "http://localhost:3000",
        apiBasePath: "/authapi",
        websiteBasePath: "/todolist",
    },
    // recipeList contains all the modules that you want to
    // use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
    recipeList: [
        EmailPassword.init(), 
        Session.init(),
        Dashboard.init({
            apiKey: "jLc-owsMYZMSzGSdo5PKnvZsnoQz8J"
        }),
    ],
};
Copy code
import EmailPassword from "supertokens-auth-react/recipe/emailpassword";
import Session from "supertokens-auth-react/recipe/session";

export const SuperTokensConfig = {
    appInfo: {
        appName: "SuperTokens Demo App",
        apiDomain: "http://localhost:3000",
        websiteDomain: "http://localhost:3000",
    },
    // recipeList contains all the modules that you want to
    // use from SuperTokens. See the full list here: https://supertokens.com/docs/guides
    recipeList: [EmailPassword.init(), Session.init()],
};
n
apiDomain: "http://localhost:3000"
Should use port 3001
On the backend youve set it to
apiDomain: "http://localhost:3001"
You also have to set apiBasePath and websiteBasePath in the frontend config
d
wow I have missed this step.. Thanks a lot! Could you help me setting up database to save registered user?
r
hey @DavidK checkout our docs for this please
d
yo @rp thanks for the docs, but I've been following them and I can't get a single userid or email from DB
DB:
r
so the tables were created when u started the core - this means the core connected to the db just fine
can i see the core's output logs?
d
r
huh.. so this means the core hasn't connected to the db. Whats the location of the config.yaml file that you changed?
d
C:\Program Files\supertokens
r
I see that
mysql_connection_uri
is commented out in the file
you need to remove the
#
before that config and restart the core
d
Oh okay, I've done it and I've got still zero results in db
r
did you restart the core? What are the logs on start?
d
yes I've restarted
r
It does say that it has connected to mysql
d
I see, but in which table should I see the user?
r
can you sign up on the app, and then restart the core and then see if you can sign in with the user?
d
okay, gimme sec
I've restarted the core and automatically got this screen:
r
logout and sign in again
d
Yep it works
where could I see that user?
r
so it is saving in the db
d
But in which table? 😄
r
which db are you quering? and which login method did you use?
check the session_info table
check the emailpassword_users table (if you used email / password to sign up)
d
mysql, email password method session_info table empty
also emailpassword_users table empty
that's quite strange I guess
without docker
r
im not sure how this is possible
but the core is definitely connetcted to mysql
d
maybe this host or port is wrong?
or somethin.. dunno :/
r
Well.. not sure. Check which db you are querying. It seems like a different db than the one the core is connected to.
d
Does the config.yaml has to be in same path/folder like the whole core setup?
r
Yes
d
So I should only put config.yaml from this folder to the exact path of the core setup?
or somethin else?
r
There is already a config yaml in the installation path. Edit that
d
Hm this is what I have