mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	fix(server): oauth mobile callback url (#2339)
* fix(server): mobile redirect uri * chore: add test
This commit is contained in:
		| @@ -97,7 +97,7 @@ export class OAuthCore { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   private normalize(redirectUri: string) { |   private normalize(redirectUri: string) { | ||||||
|     const isMobile = redirectUri === MOBILE_REDIRECT; |     const isMobile = redirectUri.startsWith(MOBILE_REDIRECT); | ||||||
|     const { mobileRedirectUri, mobileOverrideEnabled } = this.config.oauth; |     const { mobileRedirectUri, mobileOverrideEnabled } = this.config.oauth; | ||||||
|     if (isMobile && mobileOverrideEnabled && mobileRedirectUri) { |     if (isMobile && mobileOverrideEnabled && mobileRedirectUri) { | ||||||
|       return mobileRedirectUri; |       return mobileRedirectUri; | ||||||
|   | |||||||
| @@ -154,6 +154,17 @@ describe('OAuthService', () => { | |||||||
|  |  | ||||||
|       expect(callbackMock).toHaveBeenCalledWith('http://mobile-redirect', { state: 'state' }, { state: 'state' }); |       expect(callbackMock).toHaveBeenCalledWith('http://mobile-redirect', { state: 'state' }, { state: 'state' }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     it('should use the mobile redirect override for ios urls with multiple slashes', async () => { | ||||||
|  |       sut = create(systemConfigStub.override); | ||||||
|  |  | ||||||
|  |       userMock.getByOAuthId.mockResolvedValue(userEntityStub.user1); | ||||||
|  |       userTokenMock.create.mockResolvedValue(userTokenEntityStub.userToken); | ||||||
|  |  | ||||||
|  |       await sut.login({ url: `app.immich:///?code=abc123` }, loginDetails); | ||||||
|  |  | ||||||
|  |       expect(callbackMock).toHaveBeenCalledWith('http://mobile-redirect', { state: 'state' }, { state: 'state' }); | ||||||
|  |     }); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   describe('link', () => { |   describe('link', () => { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user