Replies: 1 comment
-
same use case here. not graphql though, but external api endpoints with authentication. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, is it possible to use external server for auth?
I have a backend server login endpoint which accepts email, password and returns JWT token.
I need next-auth to use this login method as-is, i.e. no secrets, custom cookies etc. My nextjs app must be completely stateless (I can't have database or in-memory session managment).
In my case I have a graphql backend separate server. The backend also provides auth and login-check endpoints. My nextjs application works as frontend. All requests from react components go directly to graphql backend. The backend looks for
authorization
cookie.So next-auth should use remote endpoint to login and get jwt token, then set this token as
Authorization
cookie, check the cookie and redirect to login if the cookie is no longer valid (the backend also provides method to check if the token is still valid)Thanks.
Beta Was this translation helpful? Give feedback.
All reactions