(state: string)
| 23 | } |
| 24 | |
| 25 | export function appleAuthUrl(state: string) { |
| 26 | // const options: SignInWithAppleOptions = { |
| 27 | // clientId: 'dev.junyi.PaperDebugger', // Apple Client ID |
| 28 | // redirectURI: REDIRECT_URI, |
| 29 | // state: state, |
| 30 | // // responseMode: 'query', |
| 31 | // scopes: 'name' |
| 32 | // }; |
| 33 | const url = new URL("https://appleid.apple.com/auth/authorize"); |
| 34 | url.searchParams.set("redirect_uri", REDIRECT_URI); |
| 35 | url.searchParams.set("state", state); |
| 36 | url.searchParams.set("nonce", Math.random().toString(36).substring(2, 15)); // Recommended to add nonce |
| 37 | url.searchParams.set("scope", "name email"); |
| 38 | url.searchParams.set("response_mode", "form_post"); // Or "form_post" |
| 39 | url.searchParams.set("client_id", "dev.junyi.PaperDebugger.si"); |
| 40 | url.searchParams.set("response_type", "code id_token"); |
| 41 | return url.toString(); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Check if running in Office Add-in environment |
no test coverage detected