3

When using Huawei AppGallery Connect Auth Service, I tried to get user profiles by using getPhone(), getEmail(), getDisplayName(), etc according to the reference from Huawei Developer Site. But for the most time, if not all the time, getEmail() returns a null. So does getPhone().

How do I suppose to manage the user profile if such info is always empty?

Zinna
  • 1,947
  • 2
  • 5
  • 20

2 Answers2

1

Your best practice would be to capture such info and mange it locally regardless what is available from AGConnectAuth.getInstance().getCurrentUser(). getPhone() would return a value when using Auth service by registering with phone number. getEmail would return a value when registering with email account. This is not ideal, but this is what has been designed.

Zinna
  • 1,947
  • 2
  • 5
  • 20
0

getEmail() and getPhone() are used to obtain information about the email address and the mobile number of current signed-in user. This parameter is returned when email or mobile number authentication of Auth Service is used by a user. Then you can manage the user profiles.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • Could email and/or phone number be extracted and returned from authentication credentials if it is contained in such credentials? –  Dec 31 '20 at 15:29