File tree Expand file tree Collapse file tree
Firebase/functions/src/auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,12 +24,32 @@ function getAppleConfiguration() {
2424 const clientId = process . env . APPLE_CLIENT_ID ;
2525 const keyId = process . env . APPLE_KEY_ID ;
2626 const privateKey = ( process . env . APPLE_PRIVATE_KEY || "" ) . replace ( / \\ n / g, "\n" ) ;
27+ const configs = {
28+ APPLE_TEAM_ID : teamId ,
29+ APPLE_CLIENT_ID : clientId ,
30+ APPLE_KEY_ID : keyId ,
31+ APPLE_PRIVATE_KEY : privateKey
32+ } ;
33+ const missingKeys = Object . entries ( configs )
34+ . filter ( ( [ , value ] ) => ! value )
35+ . map ( ( [ key ] ) => key ) ;
2736
28- if ( ! teamId || ! clientId || ! keyId || ! privateKey ) {
29- throw new HttpsError ( 'internal' , 'Missing Apple configuration' ) ;
37+ if ( 0 < missingKeys . length ) {
38+ console . error ( "Missing Apple configuration" , {
39+ missingKeys
40+ } ) ;
41+ throw new HttpsError (
42+ 'internal' ,
43+ `Missing Apple configuration for: ${ missingKeys . join ( ", " ) } `
44+ ) ;
3045 }
3146
32- return { teamId, clientId, keyId, privateKey } ;
47+ return {
48+ teamId : teamId ! ,
49+ clientId : clientId ! ,
50+ keyId : keyId ! ,
51+ privateKey : privateKey !
52+ } ;
3353}
3454
3555export const requestAppleCustomToken = onCall ( {
You can’t perform that action at this time.
0 commit comments