File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
android/src/main/java/com/codetrixstudio/capacitor/GoogleAuth Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,13 @@ private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
7878 JSObject user = new JSObject ();
7979 user .put ("serverAuthCode" , account .getServerAuthCode ());
8080 user .put ("authentication" , authentication );
81+
82+ user .put ("displayName" , account .getDisplayName ());
83+ user .put ("email" , account .getEmail ());
84+ user .put ("familyName" , account .getFamilyName ());
85+ user .put ("givenName" , account .getGivenName ());
86+ user .put ("id" , account .getId ());
87+ user .put ("imageUrl" , account .getPhotoUrl ());
8188
8289 signInCall .success (user );
8390
Original file line number Diff line number Diff line change @@ -80,7 +80,13 @@ public class GoogleAuth: CAPPlugin {
8080 " idToken " : user. authentication. idToken,
8181 " refreshToken " : user. authentication. refreshToken,
8282 ] ,
83- " serverAuthCode " : user. serverAuthCode
83+ " serverAuthCode " : user. serverAuthCode,
84+ " email " : user. profile. email,
85+ " familyName " : user. profile. familyName,
86+ " givenName " : user. profile. givenName,
87+ " id " : user. userID,
88+ " imageUrl " : user. profile. imageURL ( withDimension: 100 ) ,
89+ " name " : user. profile. name
8490 ] ) ;
8591 }
8692}
Original file line number Diff line number Diff line change @@ -59,6 +59,14 @@ export class GoogleAuthWeb extends WebPlugin implements GoogleAuthPlugin {
5959
6060 const authResponse = googleUser . getAuthResponse ( true ) ;
6161
62+ const profile = googleUser . getBasicProfile ( ) ;
63+ user . email = profile . getEmail ( ) ;
64+ user . familyName = profile . getFamilyName ( ) ;
65+ user . givenName = profile . getGivenName ( ) ;
66+ user . id = profile . getId ( ) ;
67+ user . imageUrl = profile . getImageUrl ( ) ;
68+ user . name = profile . getName ( ) ;
69+
6270 user . authentication = {
6371 accessToken : authResponse . access_token ,
6472 idToken : authResponse . id_token
You can’t perform that action at this time.
0 commit comments