NextAuth.js Credentials Provider Fails Authentication with Japanese Locale Despite Valid Credentials #12571
Replies: 1 comment
-
Found the bug, wasn't related to nextauth |
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
-
Describe the Problem
I am experiencing an issue with the NextAuth.js Credentials Provider where authentication works perfectly for users accessing the site in English locale, but fails when the browser's locale is set to Japanese(or italian, arabic etc). The failure occurs even when simple passwords (e.g., 123) are used, and the credentials are valid. The server responds with a 401 Unauthorized error when using Japanese locale.
Reproduction Steps
Set up NextAuth.js with the Credentials Provider using a custom authorize function to validate credentials against an API endpoint.
Test authentication in a browser with the language preference set to English (e.g., en-US). Authentication works as expected.
Change the system's language preference to Japanese or italian or arabic.
Attempt to log in with the same valid credentials (e.g., username: testuser, password: 123).
The server responds with 401 Unauthorized.
Expected Behavior
Authentication should succeed regardless of the system's language preference, provided the credentials are valid.
No relevant logs from the API server side indicating failed authentication logic.
Environment
NextAuth.js Version: ^4.24.7
Next.js Version: ^14.2.1
Node.js Version: v20.12.0
Beta Was this translation helpful? Give feedback.
All reactions