Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Firebase Auth token with null email address is resulting in a null User #189

Open
@fwpascual

Description

@fwpascual

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.

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 valid User object? I do not require the email for any of my API code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions