better error handling?
All checks were successful
Deploy to Server / deploy (push) Successful in 28s
All checks were successful
Deploy to Server / deploy (push) Successful in 28s
This commit is contained in:
@@ -31,7 +31,13 @@ async function generateAppleClientSecret(): Promise<string> {
|
|||||||
|
|
||||||
// Resolve relative to the server/ directory (where the process runs from).
|
// Resolve relative to the server/ directory (where the process runs from).
|
||||||
const absolutePath = resolve(process.cwd(), keyPath);
|
const absolutePath = resolve(process.cwd(), keyPath);
|
||||||
const pem = readFileSync(absolutePath, 'utf8');
|
let pem: string;
|
||||||
|
try {
|
||||||
|
pem = readFileSync(absolutePath, 'utf8');
|
||||||
|
} catch {
|
||||||
|
console.warn(`[auth] Apple private key not found at ${absolutePath}. Web Sign in with Apple disabled.`);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
const privateKey = await importPKCS8(pem, 'ES256');
|
const privateKey = await importPKCS8(pem, 'ES256');
|
||||||
|
|
||||||
return await new SignJWT({})
|
return await new SignJWT({})
|
||||||
|
|||||||
Reference in New Issue
Block a user