Repository navigation
fix(cli): add locale=en to OAuth authorization URL - #262
1abcdefggs wants to merge 2 commits into
Conversation
|
@1abcdefggs, thank you for all the detail on this and submitting a patch. this was a longstanding and embarrassing bug for us. i believe it's finally fixed on Reddit's server now so i hope this patch will be unnecessary. would you mind trying and let us know? thank you! |
|
Hi @stephenoid, I was truly surprised that it was resolved so quickly!!! To be absolutely sure, I tested it using several different language preferences in my Reddit account settings, including Japanese and Spanish, and I can confirm that it now works perfectly. The Since the problem has been beautifully resolved on the server side, this patch is no longer necessary. Test Results1. Standard Login (
|
|
@1abcdefggs thanks so much!! |


Closes #
💸 TL;DR
Fixes a login failure in
npx devvit login --copy-pastefor non‑English users.Reddit’s OAuth approval form localizes the submit button value, causing
access_deniedwhen the value is not "Allow".Adding
locale=ento the OAuth URL forces the form to load in English and resolves the issue.📜 Details
Fixing Login Errors Due to Language Settings
npx devvit login --copy-paste
It was found that login fails in both patterns.
Actions Checked:
▶English
You can log in with Google and access.
▶Other Languages (Tested Italian, Japanese, French, German, Arabic)
Note: This also does not work in Chrome, Edge, Opera browsers, or in incognito mode.
The cause is a mismatch in the value submitted in the Reddit authentication form. This is because the form value will be a value other than "Allow" depending on the user's display language.
The server expects a fixed value of "Allow," so when it receives a value translated by the user's language settings, it returns access_denied.
Non-English Settings: Reddit's localization feature translates the
valueattribute, which is the value sent internally.Solution: Correct Form Value with
locale=enTo avoid this form validation error,
locale=enwas added to the beginning of the URL parameters.Note: If using a language other than English, manually changing the "available" value in the form to "Allow" before authentication will allow you to log in.
Forcing the entire page to load in English ensures that the form value is "Allow," guaranteeing successful authentication.
This eliminates the need for users to change their browser settings (a temporary solution), allowing them to complete login using only standard CLI operations.
Protection and Visibility of * (%2A)
Reddit OAuth specifications require the wildcard * to be correctly maintained as %2A. Specifying
locale=enprevents encoding issues caused by redirects (such as reverting back to *).User Transparency:
locale=enis placed near the beginning of the URL. This makes it easier for users to intuitively understand the intention that "security authentication is currently being performed in English" simply by looking at the URL.This is not a fundamental solution. At the very least, a mechanism should be in place to prevent the value of the form's name field from being translated.
🚨 Problem Summary
Users with non‑English browser language settings (Japanese, German, Italian, French, Arabic, etc.) experience OAuth login failures when running:
npx devvit loginnpx devvit login --copy-pasteThe Reddit authorization form localizes the submit button value:
However, the server expects the fixed English value
"Allow".When a localized value is submitted, the server returns
access_denied.🔧 Technical Root Cause
The OAuth approval form is localized based on the user's browser language.
The backend validation does not accept localized values and only accepts
"Allow".This mismatch causes the login flow to fail for international users.
💡 Solution
Add
locale=ento the OAuth authorization URL to force the form to load in English.This ensures:
"Allow"*) remain correctly encoded through redirects📊 Impact
🧪 Testing Steps / Validation
"Allow"makes login succeedlocale=en, login succeeds in all tested non‑English environmentsThis indicates that the display language is influencing the process.
npx devvit login(localhost mode)npx devvit login --copy-pastework correctly
🔗 Related Issue
Fixes OAuth login failures caused by localization of the approval form.
✅ Checks