fix(server): oauth mobile callback url (#2339)
* fix(server): mobile redirect uri * chore: add test
This commit is contained in:
parent
c329a17975
commit
c4f5dc6d01
2 changed files with 12 additions and 1 deletions
|
@ -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', () => {
|
||||||
|
|
Loading…
Reference in a new issue