mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-31 17:19:56 +08:00
feat(core): support apple sign in (#12424)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { defineModuleConfig, JSONSchema } from '../../base';
|
||||
|
||||
export interface OAuthProviderConfig {
|
||||
@@ -21,6 +23,7 @@ export interface OAuthOIDCProviderConfig extends OAuthProviderConfig {
|
||||
export enum OAuthProviderName {
|
||||
Google = 'google',
|
||||
GitHub = 'github',
|
||||
Apple = 'apple',
|
||||
OIDC = 'oidc',
|
||||
}
|
||||
declare global {
|
||||
@@ -29,6 +32,7 @@ declare global {
|
||||
providers: {
|
||||
[OAuthProviderName.Google]: ConfigItem<OAuthProviderConfig>;
|
||||
[OAuthProviderName.GitHub]: ConfigItem<OAuthProviderConfig>;
|
||||
[OAuthProviderName.Apple]: ConfigItem<OAuthProviderConfig>;
|
||||
[OAuthProviderName.OIDC]: ConfigItem<OAuthOIDCProviderConfig>;
|
||||
};
|
||||
};
|
||||
@@ -71,5 +75,29 @@ defineModuleConfig('oauth', {
|
||||
issuer: '',
|
||||
args: {},
|
||||
},
|
||||
schema,
|
||||
link: 'https://openid.net/specs/openid-connect-core-1_0.html',
|
||||
shape: z.object({
|
||||
issuer: z
|
||||
.string()
|
||||
.url()
|
||||
.regex(/^https?:\/\//, 'issuer must be a valid URL')
|
||||
.or(z.string().length(0)),
|
||||
args: z.object({
|
||||
scope: z.string().optional(),
|
||||
claim_id: z.string().optional(),
|
||||
claim_email: z.string().optional(),
|
||||
claim_name: z.string().optional(),
|
||||
}),
|
||||
}),
|
||||
},
|
||||
'providers.apple': {
|
||||
desc: 'Apple OAuth provider config',
|
||||
default: {
|
||||
clientId: '',
|
||||
clientSecret: '',
|
||||
},
|
||||
schema,
|
||||
link: 'https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/implementing_sign_in_with_apple_in_your_app',
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user