https://supertokens.com/ logo
#general
Title
# general
k

Kartik

03/30/2022, 3:27 PM
how do i connect supertokens container with my postgres container
r

rp

03/30/2022, 3:28 PM
how do i connect supertokens container with my postgres container
k

Kartik

03/30/2022, 3:29 PM
thats what i did
and for container to containe connection i tried using a network too
but it failed
r

rp

03/30/2022, 3:30 PM
what's the error? Can I see what you did?
k

Kartik

03/30/2022, 3:31 PM
let me try to change the host to host.docker.internal
yeah its running now
i always forget to use host.docker.internal to connect container on window
r

rp

03/30/2022, 3:47 PM
hehe fair enough.
k

Kartik

03/30/2022, 4:02 PM
Copy code
AuthModule.forRoot({
      // These are the connection details of the app you created on supertokens.com
      connectionURI:     HERE it will be the localhost url for the token container,
      apiKey: "0Eul7zuxDFhA6pjWFlch4GlNG=o-Sm",  <---------------- what should be provided here?
      appInfo: {
        // Learn more about this on https://supertokens.com/docs/thirdparty/appinfo
        appName: "Shoeshion",
        apiDomain: "http://localhost:5000",
        websiteDomain: "http://localhost:4000",
        apiBasePath: "/auth",
        websiteBasePath: "/login"
      },
    }),
apiKey is not necessary in development?
r

rp

03/30/2022, 4:04 PM
not necessary for self hosted
you can just remove the
apiKey
field entirely.
k

Kartik

03/30/2022, 4:04 PM
ok
i would need to find a way to get the tables into prisma file
r

rp

03/30/2022, 4:05 PM
Well. You don't need to
SuperTokens can manage it's tables on its own and you would never have to interact with them directly anyway
But if you want to, the link I sent above has the schema
k

Kartik

03/30/2022, 4:07 PM
i need to connect user to other table or i can just create a table with user data i will recieve
r

rp

03/30/2022, 4:07 PM
Yea. You should create your own table with the user data you receive
k

Kartik

03/30/2022, 4:08 PM
so for the redirect url in the google strategy
rishab bro, google need a redirect url
where do i put that?
r

rp

03/30/2022, 4:14 PM
You mean where in google's dashboard do you put that? or where in the supertoken's code?
k

Kartik

03/30/2022, 4:14 PM
in super token code
r

rp

03/30/2022, 4:15 PM
So supertokens expects that the callback is on /auth/callback/google
So you should put that in google's dashboard
k

Kartik

03/30/2022, 4:15 PM
ohh
so close
r

rp

03/30/2022, 4:16 PM
haha..
k

Kartik

03/30/2022, 4:19 PM
do i need a controller for auth now?
r

rp

03/30/2022, 4:20 PM
im not sure what you mean by controller
k

Kartik

03/30/2022, 4:21 PM
in nestjs we create controller for routes
r

rp

03/30/2022, 4:22 PM
What url have you put on google? What is your appInfo (websiteDomain + apiDomain value) config on the frontend and backend?
k

Kartik

03/30/2022, 4:23 PM
Copy code
appName: "Shoeshion",
    apiDomain: "http://localhost:5000",
    websiteDomain: "http://localhost:4000",
    apiBasePath: "/auth",
    websiteBasePath: "/login",
Frontend
r

rp

03/30/2022, 4:23 PM
The redirect url on google should be
http://localhost:4000/login/callback/google
k

Kartik

03/30/2022, 4:24 PM
oh
r

rp

03/30/2022, 4:24 PM
since your
websiteBasePath
is
/login
k

Kartik

03/30/2022, 4:26 PM
do you have some time for voice call
r

rp

03/30/2022, 4:31 PM
You can book a call with us using the link on our site
Please feel free to do that.
k

Kartik

03/30/2022, 4:32 PM
Error: No SuperTokens core available to query
sorry
port mistake
😂 happens to me a lot when working with docker
r

rp

03/30/2022, 4:33 PM
Hehe. Lots of variables. Prone to mistakes.
k

Kartik

03/30/2022, 4:34 PM
yea
does super token has ui for self hosted?
to manage users?
r

rp

03/30/2022, 4:35 PM
Not yet. Working on it
k

Kartik

03/30/2022, 4:36 PM
ohk
now a question for me to keep using tokens auth, i have two frontends one for admin and one for users, so to enable login from both what should i do?
r

rp

03/30/2022, 5:15 PM
Are those frontends on different sub domains or different top level domains? Do they query the same backend api domain?
k

Kartik

03/30/2022, 5:16 PM
they will be based on sub domain routing
for admins it will be admin.domain.com
for user it will be store.domain or www.
r

rp

03/30/2022, 5:17 PM
Ok. So do you want one common login for both? Or different login pages?
k

Kartik

03/30/2022, 5:17 PM
common
r

rp

03/30/2022, 5:17 PM
Ok. And will they be querying the same api domain?
k

Kartik

03/30/2022, 5:18 PM
well backend will be same
only routes will protected by roles and permissions
r

rp

03/30/2022, 5:18 PM
Okay. So what you want to see is sharing sessions across sub domains
k

Kartik

03/30/2022, 5:18 PM
ok
r

rp

03/30/2022, 5:19 PM
You can find that section in common customisations > sessions > sharing sessions across sub domains
k

Kartik

03/30/2022, 5:20 PM
just need to enable session scope
and in development the issue will be using localhost
r

rp

03/30/2022, 5:26 PM
Yea.. so in dev, you can have a different config.
k

Kartik

03/30/2022, 5:32 PM
and i have no idea how i am going to do that
r

rp

03/30/2022, 5:33 PM
Pass and env var for if it’s dev or not
k

Kartik

03/30/2022, 5:35 PM
localhost doesnot support sub domain
main issue
r

rp

03/30/2022, 5:35 PM
Well. Yea. You can setup a local dev env with custom domain names. You will have to edit your /etc/hosts file. (At least on a mac)
k

Kartik

03/30/2022, 5:36 PM
on windows also its that file
r

rp

03/30/2022, 5:36 PM
I see
k

Kartik

03/30/2022, 5:53 PM
And if i want to choose different logins for both is that possible?
r

rp

03/30/2022, 5:53 PM
Yea. That’s possible too
You will need to do supertokens.init on each subdomain and setup the frontend code for each sub domain
k

Kartik

03/30/2022, 5:54 PM
And in backend
Do need two routes for login?
r

rp

03/30/2022, 5:54 PM
Backend, no change.
I mean, it really depends on what your requirements are
k

Kartik

03/30/2022, 5:55 PM
I have to build an e-commerce store
r

rp

03/30/2022, 5:55 PM
If you like, you can book a call on the site and we can discuss then
k

Kartik

03/30/2022, 5:55 PM
Ohk
Will try
r

rp

03/30/2022, 5:55 PM
If you have any really specific question, you can ask here, else we can discuss on a call
k

Kartik

03/30/2022, 5:56 PM
So i have three apps, 1st store, 2nd admin and 3rd is my backend
4 Views