Hello, I am having trouble with pushing the login ...
# support-questions-legacy
c
Hello, I am having trouble with pushing the login from my localhost to a server with an actual url. Right now I can get to the /auth area where I see the supertokens page, but when I try to log in with google or via email password, it says error and throws a 405 error code for url
auth/session/refresh
. I have gone over my express app and the front end a bunch of times and can't seem to figure out why this would happen. Is it because nginx is blocking it? Or is it because the site is https? Do I need to allow this url or something to pass through in a different config? Or is my code config wrong? Thanks in advance for the help, I really appreciate it.
r
Hey @c9win.
We don’t send a 405 back to the client. Can you check where this status code is coming back from?
Maybe if you are using nginx in front, is that returning 405?
c
Possibly? I see this in the access log
POST /auth/session/refresh HTTP/2.0" 405 584
I have the express app running on the server, then in the sites nginx I put this
Copy code
location /login/ {
        proxy_pass    http://127.0.0.1:3001/;
    }
and have the front end pointing to the /login for api domain
r
Right. So /login is stripped away from the request?
So u are querying /login/auth/session/refresh on the frontend?
c
the url that is throwing the 405 doesn't have /login in it
is just [url]/auth/session/refresh
r
I’m pretty sure it’s nginx returning this
It means method not allowed
c
yeah i think so too
r
So check your nginx config
Based on the code, it seems you route all /login paths to the 127.0.0.1:3001 service.
So I think the apiBasePath on the frontend should be /login/auth
But I’m not 100% sure about this
c
ok, so for local I have
Copy code
appInfo: {
    appName: "My Demo App",
    apiDomain: http://localhost:3001,
    websiteDomain: http://localhost:3000,
  },
and then for prod i have
Copy code
appInfo: {
    appName: "My Demo App",
    apiDomain: [url]/login,
    websiteDomain: [url],
  },
but in the requests
for local sign in i see
http://localhost:3001/auth/signin
which is correct
but then for prod signin i see
[url]/auth/signin
which is incorrect
so thats weird
ah, i didn't know I needed the apiBasePath, just saw that now that you said it
so the /login was being stripped from the url
its working 🥲 thank you
r
One more thing, does the /login part get stripped away by nginx? If so, you would need to set apiBasePath as /auth in the backend and also add another config called apiGatewayPath and set that to /login on the backend
But frontend apiBasePath would remain as /login/auth
c
my backend is
Copy code
appInfo: {
    appName: "Name",
    apiDomain: "[url]/login",
    websiteDomain: "[url]",
  },
but it is working right now
but youre saying to add those 2 more to this?
r
remove the
/login
from apiDomain
and add
/login
to apiGatewayPath on the backend - this is an additional config in the appInfo object
c
Copy code
appInfo: {
    appName: "name",
    apiDomain: "[url]",
    websiteDomain: "[url]",
    apiGatewayPath: "/login"
  },
works as well
r
yea
cool!
c
🙏 appreciate it
5 Views