@@ -53,7 +53,7 @@ public async Task<IActionResult> Facebook([FromBody]FacebookAuthViewModel model)
5353 }
5454
5555 // 3. we've got a valid token so we can request user data from fb
56- var userInfoResponse = await Client . GetStringAsync ( $ "https://graph.facebook.com/v2.8/me?fields=id,email,first_name,last_name,name,gender,birthday,picture&access_token={ model . AccessToken } ") ;
56+ var userInfoResponse = await Client . GetStringAsync ( $ "https://graph.facebook.com/v2.8/me?fields=id,email,first_name,last_name,name,gender,locale, birthday,picture&access_token={ model . AccessToken } ") ;
5757 var userInfo = JsonConvert . DeserializeObject < FacebookUserData > ( userInfoResponse ) ;
5858
5959 // 4. ready to create the local user account (if necessary) and jwt
@@ -75,7 +75,7 @@ public async Task<IActionResult> Facebook([FromBody]FacebookAuthViewModel model)
7575
7676 if ( ! result . Succeeded ) return new BadRequestObjectResult ( Errors . AddErrorsToModelState ( result , ModelState ) ) ;
7777
78- await _appDbContext . Customers . AddAsync ( new Customer { IdentityId = appUser . Id , Location = "" } ) ;
78+ await _appDbContext . Customers . AddAsync ( new Customer { IdentityId = appUser . Id , Location = "" , Locale = userInfo . Locale , Gender = userInfo . Gender } ) ;
7979 await _appDbContext . SaveChangesAsync ( ) ;
8080 }
8181
0 commit comments