Use external API with PassportJS #13552
-
I have an external API with PassportJS authentication configured in it using the local strategy and everything is working perfectly. The question I have is related to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
The So, I think the example won't be of much help when you use an external API with Passport. There are different ways to approach your setup, you can make calls from the client to your external API and share a token between the Next.js app and your API. You can also create API routes in your Next.js app that will call your external API. If you need to use an external API and want to keep the session management in Next.js you could handle your sessions with API routes and query your external API from there too. |
Beta Was this translation helpful? Give feedback.
The
with-passport
example is to explain how to use Passport with API routes. I think all examples aim to show how to use different tech in Next.js.So, I think the example won't be of much help when you use an external API with Passport.
There are different ways to approach your setup, you can make calls from the client to your external API and share a token between the Next.js app and your API. You can also create API routes in your Next.js app that will call your external API.
If you need to use an external API and want to keep the session management in Next.js you could handle your sessions with API routes and query your external API from there too.