how do i connect supertokens container with my pos...
# general
k
how do i connect supertokens container with my postgres container
r
how do i connect supertokens container with my postgres container
k
thats what i did
and for container to containe connection i tried using a network too
but it failed
r
what's the error? Can I see what you did?
k
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
hehe fair enough.
k
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
not necessary for self hosted
you can just remove the
apiKey
field entirely.
k
ok
i would need to find a way to get the tables into prisma file
r
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
i need to connect user to other table or i can just create a table with user data i will recieve
r
Yea. You should create your own table with the user data you receive
k
so for the redirect url in the google strategy
rishab bro, google need a redirect url
where do i put that?
r
You mean where in google's dashboard do you put that? or where in the supertoken's code?
k
in super token code
r
So supertokens expects that the callback is on /auth/callback/google
So you should put that in google's dashboard
k
ohh
so close
r
haha..
k
do i need a controller for auth now?
r
im not sure what you mean by controller
k
in nestjs we create controller for routes
r
What url have you put on google? What is your appInfo (websiteDomain + apiDomain value) config on the frontend and backend?
k
Copy code
appName: "Shoeshion",
    apiDomain: "http://localhost:5000",
    websiteDomain: "http://localhost:4000",
    apiBasePath: "/auth",
    websiteBasePath: "/login",
Frontend
r
The redirect url on google should be
http://localhost:4000/login/callback/google
k
oh
r
since your
websiteBasePath
is
/login
k
do you have some time for voice call
r
You can book a call with us using the link on our site
Please feel free to do that.
k
Error: No SuperTokens core available to query
sorry
port mistake
😂 happens to me a lot when working with docker
r
Hehe. Lots of variables. Prone to mistakes.
k
yea
does super token has ui for self hosted?
to manage users?
r
Not yet. Working on it
k
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
Are those frontends on different sub domains or different top level domains? Do they query the same backend api domain?
k
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
Ok. So do you want one common login for both? Or different login pages?
k
common
r
Ok. And will they be querying the same api domain?
k
well backend will be same
only routes will protected by roles and permissions
r
Okay. So what you want to see is sharing sessions across sub domains
k
ok
r
You can find that section in common customisations > sessions > sharing sessions across sub domains
k
just need to enable session scope
and in development the issue will be using localhost
r
Yea.. so in dev, you can have a different config.
k
and i have no idea how i am going to do that
r
Pass and env var for if it’s dev or not
k
localhost doesnot support sub domain
main issue
r
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
on windows also its that file
r
I see
k
And if i want to choose different logins for both is that possible?
r
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
And in backend
Do need two routes for login?
r
Backend, no change.
I mean, it really depends on what your requirements are
k
I have to build an e-commerce store
r
If you like, you can book a call on the site and we can discuss then
k
Ohk
Will try
r
If you have any really specific question, you can ask here, else we can discuss on a call
k
So i have three apps, 1st store, 2nd admin and 3rd is my backend
4 Views