Next.js Discord

Discord Forum

how can I auth against an oidc provider in nextjs server-side?

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
My use-case:
I have a .net application (CMS) that implements an OpenIDConnect service.
My Nextjs application (13.4.7, using app routing) tries to request content, server-side, from the CMS via an API and then renders the content in the UI. Sometimes the content requested is not public and the API requires an access token to authorize the request.

I am able to solve this in a purely client side context, there are a bazillion examples and multiple different libs that help with oidc authentication, but most of them are from the perspective of a user logging in via some UI client side.

I have not gotten any of these libs to work when running server-side. I don't need a UI, I just need my next app to auth against my .net app (the login stuff is on the cms-side).

Any ideas or libs that you could point me to is greatly appreciated! ❤️

1 Reply

Sun bearOP
Actually this one is looking very promising: https://github.com/panva/node-openid-client