feat(makelore): add platform oidc login

This commit is contained in:
brother7 committed 2026-10-10 17:29:33 +08:00
1 parent 87d3f03d75
commit 7236def07d
12 files changed
+528 -10

No files matched your search

+10
View File
@@ -24,9 +24,19 @@ describe('NianCode app deep links', () => {
});
});
it('parses the platform OIDC redirect without inventing a request id', () => {
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback?code=oauth-code&state=oauth-state')).toEqual({
type: 'desktop-auth-callback',
url: 'niancode://auth/callback?code=oauth-code&state=oauth-state',
code: 'oauth-code',
state: 'oauth-state',
});
});
it('rejects links that do not target the desktop auth callback', () => {
expect(parseNianCodeDeepLinkUrl('https://square.nianxx.cn/#desktop-auth?request_id=1')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback?code=oauth-code')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback?request_id=')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://auth/callback?request_id=1&access_token=secret')).toBeNull();
expect(parseNianCodeDeepLinkUrl('niancode://settings')).toBeNull();