Skip to content

Commit 46c9667

Browse files
committed
Add appName, so we can use the right cookie, proxy signUp and MFA finalize
1 parent 88a8055 commit 46c9667

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/auth/src/api/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ export const enum Endpoint {
7676
}
7777

7878
const CookieAuthProxiedEndpoints: string[] = [
79+
Endpoint.FINALIZE_MFA_SIGN_IN,
7980
Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN,
8081
Endpoint.SIGN_IN_WITH_EMAIL_LINK,
8182
Endpoint.SIGN_IN_WITH_IDP,
8283
Endpoint.SIGN_IN_WITH_PASSWORD,
8384
Endpoint.SIGN_IN_WITH_PHONE_NUMBER,
85+
Endpoint.SIGN_UP,
8486
Endpoint.TOKEN
8587
];
8688

@@ -291,7 +293,7 @@ export async function _getFinalTarget(
291293
if (authInternal._getPersistenceType() === PersistenceType.COOKIE) {
292294
const cookiePersistence =
293295
authInternal._getPersistence() as CookiePersistence;
294-
return cookiePersistence._getFinalTarget(finalTarget).toString();
296+
return cookiePersistence._getFinalTarget(auth, finalTarget).toString();
295297
}
296298
}
297299

packages/auth/src/platform_browser/persistence/cookie_storage.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { Persistence } from '../../model/public_types';
18+
import { Auth, Persistence } from '../../model/public_types';
1919
import type { CookieChangeEvent } from 'cookie-store';
2020

2121
const POLLING_INTERVAL_MS = 1_000;
@@ -49,12 +49,13 @@ export class CookiePersistence implements PersistenceInternal {
4949
listenerUnsubscribes: Map<StorageEventListener, () => void> = new Map();
5050

5151
// used to get the URL to the backend to proxy to
52-
_getFinalTarget(originalUrl: string): URL | string {
52+
_getFinalTarget(auth: Auth, originalUrl: string): URL | string {
5353
if (typeof window === undefined) {
5454
return originalUrl;
5555
}
5656
const url = new URL(`${window.location.origin}/__cookies__`);
5757
url.searchParams.set('finalTarget', originalUrl);
58+
url.searchParams.set('appName', auth.app.name);
5859
return url;
5960
}
6061

0 commit comments

Comments
 (0)