Contacting a custom api created in a nextjs project hosted on Vercel from an outside service authkit
Answered
Patrick MacDonald posted this in #help-forum
Hey guys not sure this is the right place for it but I'm hoping somebody could help I went to the Vercel help and then it sent me to its AI which then told me to pay for an account to get support.
I know the information is probably out there I just don't know what to search for and I've been searching the documentation a whole bunch. Basically I'm using Auth Kit and to make it work I had to create a custom api. Work os Auth Kit requires a redirect url for it to work. When hosting locally I can give the url as http://localhost:3000/auth/callback . While hosting on Vercel I have tried using https://pats-pretrip.vercel.app:3000/auth/calback and https://pats-pretrip.vercel.app/auth/callback I'm assuming the issue is that auth kit is trying to contact the api from outside the network and it is not exposed or Vercel does not allow this kind of functionality. I'm certain it's something I'm overlooking it must be possible to use auth kit with Vercel.
Any help is greatly appreciated thank you.
I know the information is probably out there I just don't know what to search for and I've been searching the documentation a whole bunch. Basically I'm using Auth Kit and to make it work I had to create a custom api. Work os Auth Kit requires a redirect url for it to work. When hosting locally I can give the url as http://localhost:3000/auth/callback . While hosting on Vercel I have tried using https://pats-pretrip.vercel.app:3000/auth/calback and https://pats-pretrip.vercel.app/auth/callback I'm assuming the issue is that auth kit is trying to contact the api from outside the network and it is not exposed or Vercel does not allow this kind of functionality. I'm certain it's something I'm overlooking it must be possible to use auth kit with Vercel.
Any help is greatly appreciated thank you.
Answered by Bengal
it should honestly work the same. maybe you haven't properly reconfigured the url in you auth kit? something something environment variables? have you checked that the api routes do exist 100% e.g. try sending manual requests to the endpoint and see the responses
3 Replies
@Patrick MacDonald Hey guys not sure this is the right place for it but I'm hoping somebody could help I went to the Vercel help and then it sent me to its AI which then told me to pay for an account to get support.
I know the information is probably out there I just don't know what to search for and I've been searching the documentation a whole bunch. Basically I'm using Auth Kit and to make it work I had to create a custom api. Work os Auth Kit requires a redirect url for it to work. When hosting locally I can give the url as http://localhost:3000/auth/callback . While hosting on Vercel I have tried using https://pats-pretrip.vercel.app:3000/auth/calback and https://pats-pretrip.vercel.app/auth/callback I'm assuming the issue is that auth kit is trying to contact the api from outside the network and it is not exposed or Vercel does not allow this kind of functionality. I'm certain it's something I'm overlooking it must be possible to use auth kit with Vercel.
Any help is greatly appreciated thank you.
Bengal
it should honestly work the same. maybe you haven't properly reconfigured the url in you auth kit? something something environment variables? have you checked that the api routes do exist 100% e.g. try sending manual requests to the endpoint and see the responses
Answer
when i use thunder client and i throw a get at http://localhost:3000/auth/callback the message I get is {
"error": {
"message": "Something went wrong",
"description": "Couldn’t sign in. If you are not sure what happened, please contact your organization admin."
}
} the same message I get when I throw a get at https://pats-pretrip.vercel.app/auth/callback how ever as soon as I click to login i get the message Invalid redirect URI . If i use http://localhost:3000/auth/callback as the redirect and have the sever running Im forwarded over to my local instance.
"error": {
"message": "Something went wrong",
"description": "Couldn’t sign in. If you are not sure what happened, please contact your organization admin."
}
} the same message I get when I throw a get at https://pats-pretrip.vercel.app/auth/callback how ever as soon as I click to login i get the message Invalid redirect URI . If i use http://localhost:3000/auth/callback as the redirect and have the sever running Im forwarded over to my local instance.
You were right I forgot to change it in the env, I was only changing the redirect uri on the dashboard not in the env ty.