From 122a733cb382c1b24dd19167f9974c23393715e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Lagos?= Date: Tue, 30 Jun 2026 22:22:09 -0400 Subject: [PATCH] Fix ORCID redirect URI double slash --- src/app/core/auth/auth.service.spec.ts | 2 ++ src/app/core/orcid/orcid-auth.service.spec.ts | 2 +- src/app/core/orcid/orcid-auth.service.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/core/auth/auth.service.spec.ts b/src/app/core/auth/auth.service.spec.ts index 4c4efc2f62b..cc446e5dc2f 100644 --- a/src/app/core/auth/auth.service.spec.ts +++ b/src/app/core/auth/auth.service.spec.ts @@ -343,6 +343,8 @@ describe('AuthService test', () => { }); it('should return a token object', () => { + mockStore.overrideSelector(getAuthenticationToken, token); + mockStore.refreshState(); const result = authService.getToken(); expect(result).toEqual(token); }); diff --git a/src/app/core/orcid/orcid-auth.service.spec.ts b/src/app/core/orcid/orcid-auth.service.spec.ts index 9909d779e31..414a799bc49 100644 --- a/src/app/core/orcid/orcid-auth.service.spec.ts +++ b/src/app/core/orcid/orcid-auth.service.spec.ts @@ -298,7 +298,7 @@ describe('OrcidAuthService', () => { it('should build the url properly', () => { const result = service.getOrcidAuthorizeUrl(mockItemUnlinkedToOrcid); - const redirectUri: string = new URLCombiner(nativeWindowService.nativeWindow.origin, encodeURIComponent(routerStub.url.split('?')[0])).toString(); + const redirectUri: string = new URLCombiner(nativeWindowService.nativeWindow.origin, routerStub.url.split('?')[0]).toString(); const url = 'orcid.authorize-url?client_id=orcid.application-client-id&redirect_uri=' + redirectUri + '&response_type=code&scope=/authenticate /read-limited'; const expected = cold('(a|)', { diff --git a/src/app/core/orcid/orcid-auth.service.ts b/src/app/core/orcid/orcid-auth.service.ts index 6175a979801..f63975ba71e 100644 --- a/src/app/core/orcid/orcid-auth.service.ts +++ b/src/app/core/orcid/orcid-auth.service.ts @@ -127,7 +127,7 @@ export class OrcidAuthService { this.configurationService.findByPropertyName('orcid.scope').pipe(getFirstSucceededRemoteDataPayload())], ).pipe( map(([authorizeUrl, clientId, scopes]) => { - const redirectUri = new URLCombiner(this._window.nativeWindow.origin, encodeURIComponent(this.router.url.split('?')[0])); + const redirectUri = new URLCombiner(this._window.nativeWindow.origin, this.router.url.split('?')[0]); return authorizeUrl.values[0] + '?client_id=' + clientId.values[0] + '&redirect_uri=' + redirectUri + '&response_type=code&scope=' + scopes.values.join(' '); }));