@@ -15,32 +15,26 @@ export const getEmailUserFields = defineUserSignupFields({
1515export const getGitHubUserFields = defineUserSignupFields ( {
1616 // NOTE: if we don't want to access users' emails, we can use scope ["user:read"]
1717 // instead of ["user"] and access args.profile.username instead
18- email : ( data : any ) => data . profile . emails [ 0 ] . value ,
19- username : ( data : any ) => data . profile . username ,
20- isAdmin : ( data : any ) => adminEmails . includes ( data . profile . emails [ 0 ] . value ) ,
18+ email : ( data : any ) => data . profile . emails [ 0 ] . email ,
19+ username : ( data : any ) => data . profile . login ,
20+ isAdmin : ( data : any ) => adminEmails . includes ( data . profile . emails [ 0 ] . email ) ,
2121} ) ;
2222
2323export function getGitHubAuthConfig ( ) {
2424 return {
25- clientID : process . env . GITHUB_CLIENT_ID , // look up from env or elsewhere
26- clientSecret : process . env . GITHUB_CLIENT_SECRET , // look up from env or elsewhere
27- scope : [ 'user' ] ,
25+ scopes : [ 'user' ] ,
2826 } ;
2927}
3028
3129export const getGoogleUserFields = defineUserSignupFields ( {
32- email : ( data : any ) => data . profile . emails [ 0 ] . value ,
33- username : ( data : any ) => data . profile . displayName ,
34- isAdmin : ( data : any ) => adminEmails . includes ( data . profile . emails [ 0 ] . value ) ,
30+ email : ( data : any ) => data . profile . email ,
31+ username : ( data : any ) => data . profile . name ,
32+ isAdmin : ( data : any ) => adminEmails . includes ( data . profile . email ) ,
3533} ) ;
3634
3735export function getGoogleAuthConfig ( ) {
38- const clientID = process . env . GOOGLE_CLIENT_ID ;
39- const clientSecret = process . env . GOOGLE_CLIENT_SECRET ;
4036 return {
41- clientID, // look up from env or elsewhere,
42- clientSecret, // look up from env or elsewhere,
43- scope : [ 'profile' , 'email' ] , // must include at least 'profile' for Google
37+ scopes : [ 'profile' , 'email' ] , // must include at least 'profile' for Google
4438 } ;
4539}
4640
0 commit comments