Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Commit 55210d3

Browse files
committed
Updates to fix the viewOnlyToken in cases there is a / or %2fF at the end
1 parent 6d45027 commit 55210d3

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/decorators/check-auth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ export default function checkAuth<T extends ConcreteSubclass<Route>>(
3737
// Need to handle view-only links before checking auth, and this is the only reasonable place to do it.
3838
// This limitation points toward replacing this decorator with a service method meant to be
3939
// called in Route.beforeModel. Decorator mixins should probably be considered an anti-pattern.
40-
const { viewOnlyToken = '' } = this.paramsFor('application') as Record<string, string>;
40+
let { viewOnlyToken = '' } = this.paramsFor('application') as Record<string, string>;
4141

4242
try {
4343
if (!this.session.isAuthenticated || this.currentUser.viewOnlyToken !== viewOnlyToken) {
44+
// This is for ENG-8174 where occasionally a %2F or / is at the end of the viewOnlyToken
45+
viewOnlyToken = viewOnlyToken.replace(/(%2[fF]|\/)$/g, '');
4446
this.currentUser.setProperties({ viewOnlyToken });
4547

4648
// Check whether user is actually logged in.

mirage/views/addons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ function fakeCheckCredentials(
478478
async function emulateUserDoingOAuthFlow(authorizedAccount: ModelInstance<AllAuthorizedAccountTypes>, schema: Schema) {
479479
await timeout(1000);
480480
// eslint-disable-next-line no-console
481-
console.log('Mirage addons view: emulateUserDoingOAuthFlow done');
481+
console.info('Mirage addons view: emulateUserDoingOAuthFlow done');
482482
const currentUser = schema.roots.first().currentUser;
483483
authorizedAccount.update({
484484
credentialsAvailable: true,

0 commit comments

Comments
 (0)