You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
REST API looking like this: /PUT /api/auth/session , that would setup a session given necessary session prerequisites (such as f.e JWT token), received by other means (supposedly faster than going through UI).
For more concrete example: given OIDC provider, I can use direct grant flow to quickly (by one http call) exchange test-user credentials to their access token. The issue is that now I have no way of giving that access token to nextauth for it to setup the whole cookie shenanigan. AFAIK there is no clear (documented) way of doing that, besides short mention that cookies are chunked.. Supposedly I could reverse-engineer that bit and add necessary code into my testing setup that would do the same stuff that nextauth doing to convince it (by setting cookies) that I do in fact have valid login, however this would require effort implementing and would be clunky with respect to updating to new versions of nextuath, which could only be avoided if such feature exists in this library.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
No response
Background
I can make test to go through login as usual (i.e redirect enter creds, etc), but that would make testing quite slow.
I have seen https://next-auth.js.org/tutorials/testing-with-cypress , but this is only cypress specific and seemingly only covering Google/Fb and other "social" OIDC providers.
Proposal
REST API looking like this: /PUT /api/auth/session , that would setup a session given necessary session prerequisites (such as f.e JWT token), received by other means (supposedly faster than going through UI).
For more concrete example: given OIDC provider, I can use direct grant flow to quickly (by one http call) exchange test-user credentials to their access token. The issue is that now I have no way of giving that access token to nextauth for it to setup the whole cookie shenanigan. AFAIK there is no clear (documented) way of doing that, besides short mention that cookies are chunked.. Supposedly I could reverse-engineer that bit and add necessary code into my testing setup that would do the same stuff that nextauth doing to convince it (by setting cookies) that I do in fact have valid login, however this would require effort implementing and would be clunky with respect to updating to new versions of nextuath, which could only be avoided if such feature exists in this library.
Beta Was this translation helpful? Give feedback.
All reactions