Running e2e tests on Vercel previews #3765
-
I'm running e2e tests (Playwright) on Vercel previews when a new version is deployed. Now comes the part where I need to signing and I'm king of blocked because my enabled OAuth providers (Google, GitHub, Facebook) don't allow dynamic return URLs and it seems there's no way to bypass the email provider. I can't use Credentials provider either because I'm using What should I do here? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hey @balazsorban44, sorry to ping you. I'm just completely blocked on this issue. Do you have a clue? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the ping. Unfortunately, there is not much NextAuth.js can do about it, since this is a limitation of OAuth providers (be it unintentional or not). We recently created some guides on how to authenticate users in preview environments, I hope that helps: https://next-auth.js.org/deployment#securing-a-preview-deployment Basically, you could use an environment variable to toggle between allowed providers, or even switch off the adapter when you are in a test/preview environment. Making sure that the actual login flow with OAuth will work is our library's responsibility, not your app's. Otherwise, you could try to use something like MSW and mock the requests that NextAuth.js makes. Especially the one to |
Beta Was this translation helpful? Give feedback.
Thanks for the ping. Unfortunately, there is not much NextAuth.js can do about it, since this is a limitation of OAuth providers (be it unintentional or not).
We recently created some guides on how to authenticate users in preview environments, I hope that helps: https://next-auth.js.org/deployment#securing-a-preview-deployment
Basically, you could use an environment variable to toggle between allowed providers, or even switch off the adapter when you are in a test/preview environment. Making sure that the actual login flow with OAuth will work is our library's responsibility, not your app's.
Otherwise, you could try to use something like MSW and mock the requests that NextAuth.js makes. …