I am running into an issue with users being unable to call my backend API that is guarded by Endpoints Framework. I've traced the issue to the below line of code within Auth. authenticateAppEngineUser.
The circumstances surrounding this issue has to do with accounts that have been created which do not have an associated email address. A reproducible example is if a user signs in with Facebook, where the Facebook account itself was created using a mobile number.
Note: The JWT is parsing fine, and I can see that the user ID is set correctly, it's just the email that is null.
The majority of my Firebase accounts authenticate perfectly fine, it's this limited subset of users without email addresses that has the issue.
I can see that the com.google.appengine.api.users.User class expects the email address is never null, so I can understand that the email check is avoiding the eventual NullPointerException that would occur during construction. However, why couldn't the presence of either email or user ID be enough to have a valid User object? I do not require the email for any of my API code.
I am running into an issue with users being unable to call my backend API that is guarded by Endpoints Framework. I've traced the issue to the below line of code within
Auth. authenticateAppEngineUser
.https://github.com/cloudendpoints/endpoints-java/blob/39b73744c9ee4e39e94d6d11638ba34810e5de07/endpoints-framework/src/main/java/com/google/api/server/spi/request/Auth.java#L103
The circumstances surrounding this issue has to do with accounts that have been created which do not have an associated email address. A reproducible example is if a user signs in with Facebook, where the Facebook account itself was created using a mobile number.
Per the Firebase documentation guidance, I am using the EspAuthenticator as described here: https://cloud.google.com/endpoints/docs/frameworks/java/authenticating-users#authenticating_with_firebase_auth
Note: The JWT is parsing fine, and I can see that the user ID is set correctly, it's just the email that is null.
The majority of my Firebase accounts authenticate perfectly fine, it's this limited subset of users without email addresses that has the issue.
I can see that the
com.google.appengine.api.users.User
class expects the email address is never null, so I can understand that the email check is avoiding the eventual NullPointerException that would occur during construction. However, why couldn't the presence of either email or user ID be enough to have a validUser
object? I do not require the email for any of my API code.