Skip to content

Commit 1363ecc

Browse files
authored
Fix languageCode parameter in action_code_url (#8912)
* Fix languageCode parameter in action_code_url * Add changeset
1 parent 0cbff6b commit 1363ecc

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

.changeset/great-cheetahs-invite.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Fixed: `ActionCodeURL` not populating `languageCode` from the url.

packages/auth/src/core/action_code_url.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('core/action_code_url', () => {
3030
'oobCode=CODE&mode=signIn&apiKey=API_KEY&' +
3131
'continueUrl=' +
3232
encodeURIComponent(continueUrl) +
33-
'&languageCode=en&tenantId=TENANT_ID&state=bla';
33+
'&lang=en&tenantId=TENANT_ID&state=bla';
3434
const actionCodeUrl = ActionCodeURL.parseLink(actionLink);
3535
expect(actionCodeUrl!.operation).to.eq(ActionCodeOperation.EMAIL_SIGNIN);
3636
expect(actionCodeUrl!.code).to.eq('CODE');
@@ -46,7 +46,7 @@ describe('core/action_code_url', () => {
4646
const actionLink =
4747
'https://www.example.com/finishSignIn?' +
4848
'oobCode=CODE&mode=signIn&apiKey=API_KEY&' +
49-
'languageCode=en';
49+
'lang=en';
5050
const actionCodeUrl = ActionCodeURL.parseLink(actionLink);
5151
expect(actionCodeUrl!.operation).to.eq(
5252
ActionCodeOperation.EMAIL_SIGNIN
@@ -57,7 +57,7 @@ describe('core/action_code_url', () => {
5757
const actionLink =
5858
'https://www.example.com/finishSignIn?' +
5959
'oobCode=CODE&mode=verifyAndChangeEmail&apiKey=API_KEY&' +
60-
'languageCode=en';
60+
'lang=en';
6161
const actionCodeUrl = ActionCodeURL.parseLink(actionLink);
6262
expect(actionCodeUrl!.operation).to.eq(
6363
ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL
@@ -68,7 +68,7 @@ describe('core/action_code_url', () => {
6868
const actionLink =
6969
'https://www.example.com/finishSignIn?' +
7070
'oobCode=CODE&mode=verifyEmail&apiKey=API_KEY&' +
71-
'languageCode=en';
71+
'lang=en';
7272
const actionCodeUrl = ActionCodeURL.parseLink(actionLink);
7373
expect(actionCodeUrl!.operation).to.eq(
7474
ActionCodeOperation.VERIFY_EMAIL
@@ -79,7 +79,7 @@ describe('core/action_code_url', () => {
7979
const actionLink =
8080
'https://www.example.com/finishSignIn?' +
8181
'oobCode=CODE&mode=recoverEmail&apiKey=API_KEY&' +
82-
'languageCode=en';
82+
'lang=en';
8383
const actionCodeUrl = ActionCodeURL.parseLink(actionLink);
8484
expect(actionCodeUrl!.operation).to.eq(
8585
ActionCodeOperation.RECOVER_EMAIL
@@ -90,7 +90,7 @@ describe('core/action_code_url', () => {
9090
const actionLink =
9191
'https://www.example.com/finishSignIn?' +
9292
'oobCode=CODE&mode=resetPassword&apiKey=API_KEY&' +
93-
'languageCode=en';
93+
'lang=en';
9494
const actionCodeUrl = ActionCodeURL.parseLink(actionLink);
9595
expect(actionCodeUrl!.operation).to.eq(
9696
ActionCodeOperation.PASSWORD_RESET
@@ -101,7 +101,7 @@ describe('core/action_code_url', () => {
101101
const actionLink =
102102
'https://www.example.com/finishSignIn?' +
103103
'oobCode=CODE&mode=revertSecondFactorAddition&apiKey=API_KEY&' +
104-
'languageCode=en';
104+
'lang=en';
105105
const actionCodeUrl = ActionCodeURL.parseLink(actionLink);
106106
expect(actionCodeUrl!.operation).to.eq(
107107
ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION

packages/auth/src/core/action_code_url.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const enum QueryField {
2929
API_KEY = 'apiKey',
3030
CODE = 'oobCode',
3131
CONTINUE_URL = 'continueUrl',
32-
LANGUAGE_CODE = 'languageCode',
32+
LANGUAGE_CODE = 'lang',
3333
MODE = 'mode',
3434
TENANT_ID = 'tenantId'
3535
}

0 commit comments

Comments
 (0)